The object rotates and then goes forward in the direction it is facing but it will not slow down. The code below shows the code which handles the speed. image_angle is defined in the previous code. sp is the current speed and mxsp is the max speed.
if (sp > mxsp) sp = mxsp;
sp = max(sp - 1,0)
if (up =! 0) motion_add(image_angle,sp)
How can I fix this?
About your code:
if (sp > mxsp) sp = mxsp;
sp = max(sp - 1,0)
you can change it to
sp = median(0, mxsp, sp - 1);
Here:
if (up =! 0) motion_add(image_angle,sp)
not understand what is up
. Must be sp
, as I understand.
=!
is incorrect, must be !=
=! 0
always is true
(= !0
, same with = 1
), so it always will add motion.