Android: 2d scrolling background

by Kewitschka   Last Updated January 13, 2018 12:13 PM

I am a very beginner in game development. All I want to achieve in the beginning is a free scrollable background like in a strategy game with my custom graphics. In my case it is supposed to be a 2d city map where the user can select buildings. How can I achieve that as easy as possible in android? With OpenGL? Die you have any examples especially for this scrolling functionality?

Answers 2

I think you should go with frameworks like Libgdx rather than using directly OpenGL. Libgdx allow you to draw graphical assets and program interactivity with them.

Here is some starting points :

Sebastien Servouze
Sebastien Servouze
January 14, 2018 20:10 PM

If you want the buildings in the backgroudn to be clickable you could create different classes for each building, assign an image to the object and use ArrayLists to determine how many you would like in the background.

You would have to run a thread in your main class to move the buildings either right or left, check the locations and if x - image.getWidth < 0 then the whole building has left the screen, this means another building needs to be added to the right.

January 25, 2018 10:07 AM

Related Questions

OpenGLES texture coordinates in shader

Updated December 16, 2016 08:05 AM