Java scrolling game on Android

I'm trying to make a simple scroll of the game just to find out about the ropes of programming games on Android. I came up with a solution on how to do this, but I don't think this is the most elegant solution. I wanted to get a few different ideas on how to implement my game, because now I have no other solution.

Here is a brief explanation of how this works.

I basically have blocks or objects that drop from the top of the screen. Blocks are determined from a predefined string that I create using a custom "map editor".

I create all the blocks at compile time, place them on the screen or beyond and just increase their coordinates with each iteration of the gameloop.

In fact, this is done a little better than this, but it gives a brief easy explanation of the main idea.

I heard from several people that instead of increasing each position of the block, block the blocks and just change the visible area. It makes sense, but I have no idea how to do this.

Can someone share some ideas or links on how I can implement something like this? I know that my current solution is not the biggest.

Thanks!

+6
java android
source share
3 answers

To learn the ropes for game programming on android, I would point you to Google I / O 2009 - Writing real-time games for Android. An I / O session over the past year and this one from 2010.

People telling you about changing the visible area probably assume that you are using OpenGL ES, which you may not know, but should probably be considered.

+7
source share

If the blocks / objects are independent of each other, I will continue to consider them as independent objects and update their position separately. In the end, you might want some of them to move differently from each other. In game development, it’s useful to leave the engine as flexible as possible, as long as you can - polishing a game includes many games and fine-tuning the mechanics of the game, and the more things you have to configure the more polished you can get it. Optimize only if necessary.

But if the blocks are not independent and will not, changing the viewing area, rather than moving each block, may be a good idea, although more information about your game will help - is it a platform? Shooter? If there is any object controlled by the player on the playing field, you will need to change its position in order to keep it on the screen when changing the viewing area, which can make things too complicated. It is hard to advise without any details.

Good question though!

EDIT:

After your comment, and I saw your other question Reducing the problem in Java with - = ' ; I think that I understand your question a little better - the main thing that I would change, from the point of view of design, would be the creation of blocks as needed, and not the creation of all of them at once. In other words, create blocks in the frame before they appear on the screen, and as soon as they exit the screen, delete them. Unless, of course, the design of the game does not require a large permanent world, but it does not look like such a game. Can the player step back or allow only one-way scrolling?

+3
source share

Replica Island ( http://code.google.com/p/replicaisland/ ) is an open source Jump and Run game on Android. (This is from a guy who was talking in real time). Perhaps you can get some good ideas from him.

+3
source share

All Articles