ashish2199 / Aidos

A beginner friendly project with aim of creating our own version of Bomberman.
GNU General Public License v3.0
41 stars 27 forks source link

Where to add Player instance in order to get instance of Player everywhere in the code #34

Open ashish2199 opened 6 years ago

ashish2199 commented 6 years ago

So far I feel Player belongs to a scene and should be placed in classes that represent levels like Sandbox class. Also I feel entities(player, enemies and other things) should be a part of scene only.

What are your opinions ?

ItsStolas commented 6 years ago

Already posted in the Pull Request, but to reiterate, I think this is a good idea too. Maybe we could have a seperate class to keep the adding functions in?

Sandbox.EntityListObject.addEntity(e);

Kind of thing? To keep Sandbox clean, but still be able to have more verbose validation on functions like addEntity().

ashish2199 commented 6 years ago

Yeah we can have something similar. This object can have methods like removeDeadEnemies( ) , addEnemyToScreen( ) , checkEnenmyCollisionWithPlayer( ) I think its a good idea to separate such functions to from sandbox class.

ItsStolas commented 6 years ago

Sounds good, though I think "checkEnenmyCollisionWithPlayer( )" would be inside each enemy, rather than a global check, wouldn't it?

ashish2199 commented 6 years ago

I feel having it local to entity is better as I feel otherwise the function will be large and complicated as it will have special case for different types of enemies.

ItsStolas commented 6 years ago

Agreed