开发者

Android 2.1 How to create sniper style game

I am trying to make a sniper style game where the user开发者_开发百科 looks through a scope to see a large image that he can navigate. The user can only see part of the image at a time. The image is supposed to be much larger than the screen size that way he has to actually navigate and look for the enemy. How do I use an image that is larger than the screen that the user can navigate?

It is kind of like when you are zoomed in to an image and you can pan the image and move it around to see different parts.


You should create your own view, overload its onDraw method and use [Canvas.drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint)][2] and onTouchEvent and/or onTrackballEvent to handle input.

[2]: http://developer.android.com/reference/android/graphics/Canvas.html#drawBitmap(android.graphics.Bitmap, android.graphics.Rect, android.graphics.Rect, android.graphics.Paint)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜