How to tilt the layout in android?

I need to tilt the layout in android about 45 degrees counterclockwise. I want to implement the game in android as stackopolis . Is there a way to align tiles like in a game. I have a tile image, and now I use canvas to align this.but there I can’t get a click event, and it's hard to align tiles.is grid view Compatable.any new idea. I have these images with me. this is the main background

main background grid

tile

I want to align this plate in grid.and I need to click the event, as in stackopolis

+7
source share
5 answers

You really don't want to use layouts to create such a game. You must create a tile engine using bitmap or OpenGL.

+9
source

You can use the following methods to rotate the view:

Note. All of the above Because: API Level 11

+4
source

If you don’t know much about creating a game, read this book.

http://www.amazon.com/dp/1430230428/?tag=stackoverfl08-20

He will teach you ALL that you need to know in order to do what you want. It also installs OpenGL ES for you to make your application enjoyable and smooth.

I would suggest OpenGL, using the Canvas class will not only be slower, but it will also be limited.

+1
source

For such a game, you should really implement your own graphic code instead of relying on standard Android layout components. Unable to rotate Android layout 45 degrees. There are two ways to do this: you can use Canvas and draw your graphics using primitives and bitmaps, or you can go with a more powerful OpenGL implementation that has a steeper learning curve but can have better results.

You can read more about 2D graphics on Android here: http://developer.android.com/guide/topics/graphics/2d-graphics.html

And more about 3D graphics here: http://developer.android.com/guide/topics/graphics/opengl.html

Keep in mind that OpenGL is more suitable for real-time games, where the game must support a good frame rate. If your game is a strategy or turn-based game, you can probably get away with a simpler implementation on canvas. I would advise you to check the following classes as part of:

Canvas http://developer.android.com/reference/android/graphics/Canvas.html

SurfaceHolder http://developer.android.com/reference/android/view/SurfaceHolder.html

GLSurfaceView http://developer.android.com/reference/android/opengl/GLSurfaceView.html

+1
source

Have you checked this Android game engine? This is called AndEngine - while I don’t need to play a lot with it - it has the functionality to have a game like “topview”, like in Diablo II.

+1
source

All Articles