Aidos icon indicating copy to clipboard operation
Aidos copied to clipboard

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

Open ashish2199 opened this issue 7 years ago • 5 comments

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 ?

ashish2199 avatar Nov 22 '17 17:11 ashish2199

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().

CoreyHendrey avatar Nov 23 '17 01:11 CoreyHendrey

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.

ashish2199 avatar Nov 23 '17 18:11 ashish2199

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

CoreyHendrey avatar Nov 27 '17 02:11 CoreyHendrey

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.

ashish2199 avatar Nov 27 '17 04:11 ashish2199

Agreed

CoreyHendrey avatar Nov 27 '17 04:11 CoreyHendrey