Closed eikofee closed 3 months ago
Also, instead of passing the elapsedTime
argument on every methods, we could put a static value in World
which updates at every frames.
Beside that, I totally agreee with these ideas.
Because there will be only one World per game instance, we won't have any instantiation issue and it will be more organized to read imo.
World
will keep the references of the entities and will handle any needed accessibility to them.
By "keep the references" do you mean that the entities will be stored in a container (vector, linkedlist, ...) ?
Yeah, something like that.
Ok. I can't think of anything opposing these ideas. It seems quite safe to implement that but let's wait for a global approval.
So, I started implementing the World
class in #6ac575 and I didn't encountered any issue while linking entities in it. The collision system is also way easier than I thought it would it to be.
Just a few other things to work on :
Player.move()
Entity
class to have either one or multiple hitboxes to keep the current code compiling, but I think all of the entities should only use multiple hitboxes (vector
, even with only one hitbox in it). Related to #2 maybe.That said, the "main" code of Game
can now be moved in World
, and we should think about the Render
class properties mentioned in #3 . Right now I think I'm able to resume the parser implementation.
Following our discussions on Discord, we are thinking about adding a
World
static class betweenGame
and all of the Entities.This class will contains all of the entities and should provide methods like checking collisions between entities and call for their handlers if so, or for the natural death of entities (out of screen for example)
It would be nice to add our ideas here before coding it.