S
SquintyP
Guest
by movement easing i mean easing character movement, when i let go of the movement key, i want the character to slowly come to a halt, not just stop immediately.
What I've been trying to do is putting a loop on the speed of the character multiplied by 0.8, slowly decreasing their speed overtime, but i haven't quite figured out how to work that. Here's the code i tried:
Create event:
spd = 12
loop = 12*0.8 while (!instance_exists(obj_char)) repeat (100) {
var
}
spdease = 0.8
key_d = ord("D");
key_a = ord("A");
Step event:
spdease = 12*0.8
if(keyboard_check(key_d)) x += spd;
if(keyboard_check(key_a)) x -= spd;
if(keyboard_check(key_d)) {
keyboard_lastkey = key_d
}
if (keyboard_check(key_a)){
keyboard_lastkey = key_a
}
if(keyboard_check(vk_nokey))and keyboard_lastkey = key_d x += loop;
if(keyboard_check(vk_nokey))and keyboard_lastkey = key_a x -= loop;
(I've just started using game maker, if you can't already tell, haha.)
What I've been trying to do is putting a loop on the speed of the character multiplied by 0.8, slowly decreasing their speed overtime, but i haven't quite figured out how to work that. Here's the code i tried:
Create event:
spd = 12
loop = 12*0.8 while (!instance_exists(obj_char)) repeat (100) {
var
}
spdease = 0.8
key_d = ord("D");
key_a = ord("A");
Step event:
spdease = 12*0.8
if(keyboard_check(key_d)) x += spd;
if(keyboard_check(key_a)) x -= spd;
if(keyboard_check(key_d)) {
keyboard_lastkey = key_d
}
if (keyboard_check(key_a)){
keyboard_lastkey = key_a
}
if(keyboard_check(vk_nokey))and keyboard_lastkey = key_d x += loop;
if(keyboard_check(vk_nokey))and keyboard_lastkey = key_a x -= loop;
(I've just started using game maker, if you can't already tell, haha.)