• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Wait Function

D

Dakota Benningfield

Guest
Hey everyone, this is my first post here so feel free to let me know if it isn't following the rules 100%, anyways I am trying to create a simple puzzle game for my first game, and am wondering if there is a good way to get the game to wait until there is a collision between the player object and a wall object before the movement can continue. I.E Player is an ice block and once moved left there can't be any further movement on the players part till the player hits the wall.

My proposed solution would be to have a variable that initializes as 0 then when the movement button is pressed it changes to 1 and on the collision it goes back to 0. My problem is that I don't know how to code in making the player wait until the variable hits 0.

Thanks so much for reading!
 
D

Dakota Benningfield

Guest
Thanks for the quick reply! Although i am confused how to do the check?

Maybe this with an if statement I'm assuming?

Edit: Tried that and it had the opposite effect?
Code:
if vspeed or hspeed = 0
    vspeed = -5
else
    vspeed +=0
I have this for the keyboard up.
 
Last edited by a moderator:
Top