Horizontal player speed.
Anleitungen
/
Horizontal player speed.
Aktualisiert 6 years ago von kdx2a

The player has a speed variable and a friction one (those aren't their names in the code, just to be clear) friction=1 most of the time. Except when on ice, then friction=0.1, and on the first frame at the beggining of each room where it's 0.5. When holding a direction, the game adds up speed into that direction.

Exemple : speed=0 Player hold left speed=-1 (negative is left) speed=-2 The player switch direction, goto right speed=-1 (speed increase) speed=0 speed=1 speed=2 (speed cap)

What that means, is than when holding left then switching right, there is momentum gathered It takes 2 frames to get to full speed in a standing position, 4 to get to the opposite of actual full speed (switching from a direction to the other)

When holding a direction and switching, we have a 2 frames window to change.

When hitting a wall, the speed is set back to 0 and you need to get all the speed back then. This doesn't change anything most of the time, since it takes two frames to get back at full speed.

Updated with correct values.

Spielstatistiken
Follower
47
Läufe
380
Spieler
47
Kürzliche Durchläufe
Neueste Threads
Veröffentlicht 6 years ago
1 Antwort
Veröffentlicht 6 years ago
0 Antworten
Veröffentlicht 7 years ago
1 Antwort
Veröffentlicht 10 years ago
1 Antwort
Moderatoren