0
\$\begingroup\$

I am developing a game just for learning. I have a GameView class extending SurfaceView, and a Scene which extends GameView (for evey scene in the game).

Each Scene object has a ArrayList variable. I was trying to implement the user interactino with every game object, figuring how to do it. The only way I thought was to implement OnTouchEvent inside the Scene and iterate every GameObject checking if user interaction collides with GameObject hitbox.

If the interaction was inside the hitbox I exec the userInteraction(MotionEvent event) method on the GameObject.

My question is, is there any better way to implement this? I am doing right? Guide me a bit please. I did googled a lot, but I didn't find anything.

I can provide code if you need.

\$\endgroup\$

Your Answer

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

Browse other questions tagged or ask your own question.