Git Product home page Git Product logo

Comments (10)

a327ex avatar a327ex commented on May 14, 2024 2

There won't be multiple areas in one room. I separate both concepts because I prefer having one thing that deals with object management and another thing that is used for everything else. You could have a Room inherit from Area, or have Area be a mixin that gets injected into Room objects, or you could just have the same object management code for all rooms that you create without an Area object and the same effect would be achieved.

from blog.

jasonjewik avatar jasonjewik commented on May 14, 2024

Instead of using:

function gotoRoom(room_type, ...)
    current_room = _G[room_type](...)
end

and calling if input:pressed('1') then goToRoom('RoomCircle')
why couldn't (or shouldn't) we use:

function goToRoom(roomIndex)
     currentRoom = roomIndex
end

which removes the need to pass in the room name as a string and allows us to pass in the name as the variable itself such as if input:pressed('1') then goToRoom(RoomCircle)?

from blog.

subraizada3 avatar subraizada3 commented on May 14, 2024

The Moses library from the previous part also includes a UUID function uniqueId() (also aliased to uid()), which can optionally take in a template string.

It seems to generate numbers sequentially from 0 (0, 1, 2, 3, ...); I haven't completed the tutorial but can't see why there would be a problem with that.

from blog.

ouchzsc avatar ouchzsc commented on May 14, 2024

Hi, SSYGEN, can i ask you a question? Why do you abstract the concept "Area"? I think the "Room" can handle gameObjects management, will there be multiple areas in one room?

from blog.

zetef avatar zetef commented on May 14, 2024

maybe i miss something but when using a = Area:new(room_name) it gives me an error saying that a is nil, but when using a = Area(room_name) it lets me use the update and draw functions. what is wrong? i tried to print everything to see what is wrong but i can't figure it out.

from blog.

raystudio9236 avatar raystudio9236 commented on May 14, 2024

First, thanks for your sharing! :)

gotoRoom() function will be better like this?

function gotoRoom(room_type, room_name, ...)
    if current_room and current_room.deactivate then 
        current_room:deactivate()
    end

    if rooms[room_name] then
        current_room = rooms[room_name]
    else
        current_room = addRoom(room_type, room_name, ...)
    end

    if current_room.activate then current_room:activate() end
end

from blog.

f-person avatar f-person commented on May 14, 2024

Hey, I noticed a typo:

  1. Create a Stage room that has no Area in it. Create a Circle object that does not inherit from GameObject...

from blog.

a327ex avatar a327ex commented on May 14, 2024

That isn't a typo.

from blog.

f-person avatar f-person commented on May 14, 2024

Isn't it? In answers You say that it is required for Circle to inherit from GameObject

As required, it inherits from GameObject, receives an area, position and optional arguments as arguments.

Edit: clarification

from blog.

f-person avatar f-person commented on May 14, 2024

Oh, sorry, I didn't notice that these are two different exercises.

from blog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.