Switching Gravity on and off?

I'm making a game in which a character moves through an environment
however, instead of adding a jump function
i want the character to turn off gravity to get over enemys
for example;
if the player comes across spikes, they should be able to tap the screen and have the character now float to the top of the screen, therefore running on the roof. Once the character is out of danger from the spikes, the player should then be able to tap the screen again, returning back to the ground.

How can i achieve this?

Comments

  • UtopianGamesUtopianGames Member Posts: 5,692
    edited February 2014
    Have you seen our runner template for only 99p this has reverse gravity in it.

    You basically need a boolean or integer to decide which way to accelerate.

    Make a game attribute call it direction and make it an integer leave it set to 0 now make a button to press to swap the direction of accelerate and do a rule if touch is pressed change game.direction to (game.direction+1)%2 then in your hero actor do if game.direction=o accelerate 270 (down) otherwise accelerate 90 (up)

    You could also use change game.direction to 1-game.direction both will work so take your pick.

    http://www.deepblueapps.com/seamless-runner-template/

    Darren.
Sign In or Register to comment.