eikofee / nene-quest

Reproduction of Nene Sakura's game "Nene quest" from the japanese anime "New Game!!" with SFML
MIT License
79 stars 5 forks source link

About that World class #4

Closed eikofee closed 3 months ago

eikofee commented 7 years ago

Following our discussions on Discord, we are thinking about adding a World static class between Game 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.

eikofee commented 7 years ago

Also, instead of passing the elapsedTime argument on every methods, we could put a static value in World which updates at every frames.

engboris commented 7 years ago
  1. Why should it be static ?
  2. What do you mean by "contains" ?

Beside that, I totally agreee with these ideas.

eikofee commented 7 years ago
  1. 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.

  2. World will keep the references of the entities and will handle any needed accessibility to them.

engboris commented 7 years ago

By "keep the references" do you mean that the entities will be stored in a container (vector, linkedlist, ...) ?

eikofee commented 7 years ago

Yeah, something like that.

engboris commented 7 years ago

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.

eikofee commented 7 years ago

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 :

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.