I am building a tower defense game for android where you have to defend the base from mobsters who have a bounty on your head. You start out with a certain amount of life, every time an enemy reaches your base you lose 1 health till you shoot them. I keep score cause later I plan on implementing that into the game as currency. You touch where you want to shoot. I have been looking at LunarView, JetBoyView, CanvasSurfaceView (SpriteMethodTest) files to try and come up with a good canvas structure for the game. I used the bits and pieces I could from all three. The thing that has me a little confused is that in the Jet Boy and Lunar Lander projects the game is done in the Views while with the Sprite Method Test it is split up between the CanvasSurfaceView and CanvasTestActivity. I was wandering as to how I should structure my View file. Should I run everything in my View class or split between the View and Game class.
Current Methods in View:
- MobView(Context context, AttributeSet attrs)
- getThread()
- surfaceChanged
- SurfaceDestroyed
- SurfaceCreated
- onWindowFocusChange
- MobThread
Methods in Thread: onRun, onPause, onResume, setRunning, setMode, setSurfacesize, MobThread, doDraw, updateGame
I have the Game AI code written is pseudo code till I figure out where I would have to put it at and whether I should use a While loop or If-else statement (it's set up for either one).