How do side sliders work?

I have been doing some research, and have been snooping around the forums, and I was wondering how a side slider game works. My idea is thE game layout would be “portrait”, and you slide a sprite left and right (can’t move up or back)by tilting the device to avoid hitting oncoming bars. But here’s the catch: as you progress, it gets faster and faster… Ooh, and score when you pass a barrier. Oh, and is there a program that would randomly generate these bars, but always have a certain amount of space for the player’s sprite to get through? Can anyone help me? Thanks.

Do you have any code complete yet?

We could write the code for all this, but that would teach you nothing. It’s better if you figure out some of these things yourself.

You need to learn

  • how to tilt the iPad (see the Gravity demo app included with Codea)

  • how to use random numbers (google random numbers in the forum or for Lua)

  • move a sprite (lots of tutorials on the wiki)

Please don’t expect other people to write all the code for you

When I have some complete code, I’ll post it. Thanks for the tips, Ignatz :slight_smile:

Ok, so here’s a code I have.


function setup()

function draw()
    background(84, 84, 84, 255)
    sprite("Space Art:Green Ship",x,y)

The only problem I have is the sprite slides off the screen. :frowning:
Any changes I should make to the code (to keep the sprite on the screen)? (I’m sure there is. I’m a total noob)

Try some tutorials

Ah ha! I got it! Thanks!