• 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!

Windows I have followed the "simple platformer" tutorial and have no idea how to program an acceleration/deceleration mechanic.

woods

Member
you can gain some insights in this thread maybe ;o)


basically holding a key down will increase/decrease the players movement in that direction(i would suggest set a max speed variable to limit the player from speeding up indefinately )

rough and raw is basically something like this...

obj_player create event
Code:
// set variables
speed = 0; //starting speed is stopped
max_speed = 5; //the fastest we can go is 5
friction = 0.1 // we need to slow down over time
obj_player step event
Code:
// hold A to speed up left
if keyboard_check(ord("A"))
{
speed -= 0.5;
}
// hold D to speed up right
if keyboard_check(ord("D"))
{
speed += 0.5;
}
 
Last edited:
Top