Enemies and items basic question

Hey guys, been playing with Corona for 4 days, i managed to create exact copy of flappy bird game just for fun, also did some highway car chase, again for fun. Now I love corona as its so logical, almost dont need tutorials, can just look up API and work from there. But as i never did games before, i have just one simple question.

It is a scroller/platform game, lets say like supermario or flappy bird, and if u want to create coins at some exact place, what would be logic behind it, would you create them all at once somewhere at faraway x position and move them to character player together as background moves. I suppose that main char and camera should not be moving, but screen and enemies/coins are moving toward him ?

Hi @goranefbl,

Good to hear your Corona experience is going well so far. For your “coins” question, it takes a bit more work up-front, but the best approach (for memory and performance) is to pre-generate a “cache” of coins and keep them off screen (or hidden and deactivated) and then pull out one of these coins every time you need to put on into the game scenario. Then, when one of these coins is collected or it goes off screen, you can place it back in the cache. This system creates a continuous recycling system which minimizes the number of coins in memory, and places them down very quickly (no performance hit) when they’re needed.

Of course, coins is just one option… it could be pipes (i.e. Flappy Bird) done in the same manner. That game could get by with around 6-8 total pipes in the entire game, constantly being recycled and repositioned.

Then, for the “camera”, Corona doesn’t really have that concept built in, but rather the screen is the view port and you move things around within it. However, you may want to check out this code bit which was created in the Corona Code Exchange:

http://code.coronalabs.com/code/perspective-virtual-camera-system

Have fun!

Brent

Hi @goranefbl,

Good to hear your Corona experience is going well so far. For your “coins” question, it takes a bit more work up-front, but the best approach (for memory and performance) is to pre-generate a “cache” of coins and keep them off screen (or hidden and deactivated) and then pull out one of these coins every time you need to put on into the game scenario. Then, when one of these coins is collected or it goes off screen, you can place it back in the cache. This system creates a continuous recycling system which minimizes the number of coins in memory, and places them down very quickly (no performance hit) when they’re needed.

Of course, coins is just one option… it could be pipes (i.e. Flappy Bird) done in the same manner. That game could get by with around 6-8 total pipes in the entire game, constantly being recycled and repositioned.

Then, for the “camera”, Corona doesn’t really have that concept built in, but rather the screen is the view port and you move things around within it. However, you may want to check out this code bit which was created in the Corona Code Exchange:

http://code.coronalabs.com/code/perspective-virtual-camera-system

Have fun!

Brent