2
\$\begingroup\$

I'm trying to develope a simple platformer on Java, I was wondering if is it better to handle the collissions in a level (player with floor, player with enemy ecc...) by a level handler class which controls all the elements in the level or pass the elements in the level to each elements and then check if collide with itself.

\$\endgroup\$
2
\$\begingroup\$

This is more of a design decision, since objects are implicitly references in Java, so it really doesn't make much difference to be copying an extra reference. I'd suggest you just do whatever works first and then, if you feel you need to, start to optimise/change things and see if you get a better result. That's the best way to learn.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.