Android game opengl

I am trying to develop a 2D game for android using opengl.

I know how to print images on the screen and animate them. But in my game I have a map and you want to zoom in and out and scroll the map. But I can’t figure out how to do this.

Can someone help me?

+6
java android opengl-es
source share
2 answers

I have no api examples, but I was designing games in college, so I will give my two bits.

The method you use will depend on your style, size, functionality and format of your card.

For example, if you are looking for a very static, non-changing map, use a simple image. You can use the API frame to view the image, allowing you to zoom in and out as you do in the gallery, and scroll through enlarged images, or in this case, zoom objects on the map.

Alternatively, if your map is based on a tile system, a good example of this is the original Pokémon and Legend of Zelda games from an old game boy, then each area stores a tile thumbnail for itself as a bitmap image. Then they are placed in the appropriate places on the grid, depending on which areas are detected.

This is perhaps the most flexible way to build your map, since you do not rely on a set of raster images for your entire map, which means that it can effectively change the appearance; you can build it at will to show the selection area (useful if the map displays only those places that the gamer has covered), and also means that you can perform tile-based overlay:

those. - if a treasure is to be contained in a certain area, then the treasure icon is superimposed on this cell x, y on the map.

I used the tile option in my college college game projects, and that made all the other cards easier. He also made the map on the side of things a smaller repository.

+1
source share

The easiest way is to simply call glTranslatef (-scrollX, -scrollY, 0), followed by glScalef (scaling, scaling, and scaling) before rendering your map.

0
source share

All Articles