Android : Android SurfaceView and animated graphics

on Monday, September 29, 2014


I want to make a "2d game" using graphics from the ressources for the characters. Now I'm asking myself what is the best solution.


I was searching a lot in the net finding the two different options.



  • A) Creating a custom view, adding it to the layout showing a AnimationDrawable or

  • B) Using the SurfaceView directly painting on it


Whereas a) is usually called slow and unperformant for games I tried to find a solution for b). But so far all tutorials are only made with one image moving around on the surfaceView or animating geometric shapes (which isn't really what I had in mind). Finding tutorials for "how to draw AnimationDrawable on SurfaceView" are very rare.


So I thought I might load all animation frames of my character into an array drawing each call the right one on the SurfaceView. But that sounds like a lot of overhead to me. Should I abandon the SurfaceView?


Has anyone a good idea what would be the best way to animate - lets say 10 characters + "background" on my screen?


0 comments:

Post a Comment