D
Dekadrachm
Guest
movespeed = 0
maxmovespeed = .2
if (keyboard_check(vk_up))
{
if (movespeed < maxmovespeed) {
movespeed += 0.1
motion_add(image_angle, movespeed)
}
else
{
movespeed = maxmovespeed
motion_add(image_angle, movespeed)
}
}
else
{
if (movespeed > 0)
{
movespeed -= .01
motion_add(image_angle, movespeed)
}
}
The object moves in the direction of rotation using the motion_add function, but the script seems to entirely ignore my if statements. the object accelerates above maxspeed and does not slow down upon key release. "if movespeed < maxmovespeed works", but if i don't set the movespeed to the maxmovespeed when im defining the variables that if statement seems to entirely ignore whether or not move speed is greater than max speed, causing acceleration above the max parameters.
maxmovespeed = .2
if (keyboard_check(vk_up))
{
if (movespeed < maxmovespeed) {
movespeed += 0.1
motion_add(image_angle, movespeed)
}
else
{
movespeed = maxmovespeed
motion_add(image_angle, movespeed)
}
}
else
{
if (movespeed > 0)
{
movespeed -= .01
motion_add(image_angle, movespeed)
}
}
The object moves in the direction of rotation using the motion_add function, but the script seems to entirely ignore my if statements. the object accelerates above maxspeed and does not slow down upon key release. "if movespeed < maxmovespeed works", but if i don't set the movespeed to the maxmovespeed when im defining the variables that if statement seems to entirely ignore whether or not move speed is greater than max speed, causing acceleration above the max parameters.