Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / how would I go about creating a game that goes on forever

Author
Message
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 5th Mar 2013 00:14
I'm thinking of making a game that plays forever, possibly similar to [href=https://play.google.com/store/apps/details?id=com.bfs.ninjump[/href] or maybe gravity guy
But how would I do this, specifically having the walls continually moving down and never 'running out'. would you do it something like this (pseudo code)

foo = (sprite twice the height of the screen)
`foo is a seamless sprite
pos as float
do
pos = pos + 1
Set foo y position, pos
if pos >= 100 then pos = 0
loop

There are 10 types of people, those who understand binary and those who don't
http://splatstudio.joshwebsites.com/
xCept
21
Years of Service
User Offline
Joined: 15th Dec 2002
Location:
Posted: 5th Mar 2013 00:20 Edited at: 5th Mar 2013 00:21
I did the same with my Little Eggy app.



Basically you recycle as many sprites as you can using similar logic to your pseudo code. I create maybe 4-6 rows of sprites to fill up the screen, and then as soon as they are out of view their positions are updated to appear at the bottom again. Of course it's a bit more involved than that but that's the basis.
easter bunny
11
Years of Service
User Offline
Joined: 20th Nov 2012
Playing: Dota 2
Posted: 5th Mar 2013 00:44
ok, I'll try this

There are 10 types of people, those who understand binary and those who don't
http://splatstudio.joshwebsites.com/
Digital Awakening
AGK Developer
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 5th Mar 2013 08:42
The same method as xCept mentioned can be used with tiles. Say you create a level with tiles. Your display is 8x16 tiles. You make enough tiles to cover the screen + 1 row. As soon as you have moved a row up you move the sprites from the bottom up on top. If you use setviewoffset you can scroll the "camera". You can have sprites stuck to the screen for clock, life etc.


Demo 3 is out now!

Login to post a reply

Server time is: 2024-05-03 08:57:29
Your offset time is: 2024-05-03 08:57:29