Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ashish2199 opened this issue Nov 22, 2017 · 5 comments

Comments

@ashish2199
Copy link
Owner

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 ashish2199 changed the title Where to add Player class in order to get instance of Player everywhere in the code Where to add Player instance in order to get instance of Player everywhere in the code Nov 22, 2017
@CoreyHendrey
Copy link
Contributor

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
Copy link
Owner Author

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.

@CoreyHendrey
Copy link
Contributor

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

@ashish2199
Copy link
Owner Author

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.

@CoreyHendrey
Copy link
Contributor

Agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants