Reputation: 13
I've never built a game before, and I've not programmed for Android before but am looking to do so over the summer by building a game.
What type of object do I use for a shape that I want the user to be able to drag around the screen for instance using touch gestures? How do I tie together the MotionEvent, View and Graphics2D to make objects drawn on screen that can be interacted with? I imagine this will use ActionListeners / Handlers but I'm a bit confused at this stage...
A simple breakdown of steps would be much appreciated. Thanks
Upvotes: 1
Views: 2776
Reputation: 55714
This is quite a broad question! :P Basically, here is what you want to do:
extends SurfaceView implements SurfaceHolder.Callback
OnTouchEvent(MotionEvent event)
is the callback when the user touches the screenAn excellent source of basic information about 2D games is the LunarLander example that comes with the SDK. It demonstrates how to make a custom view and canvas, how to multithread for continuous animation and how to handle the game state as the user switches to another app.
I've also answered lots of questions about graphics which may be helpful for you to look at. You can find a list of links here.
Upvotes: 2