i' have this code
basically what it does is pick the image angle and decompose it in a x and y acceleration, the acceleration is added to the speed and there we got a cool looking ship that slides gracefully through the room. after many tries though i can't limit the speed without messing up with the movement, the better i have got was something like
but i couldn't get anything better than a barely working speed limiter full of glitching.
any help should help ( i'm quite new to programing )
GML:
//player movement
//accel
image_angle = (image_angle + 360) mod 360;
xaccel = ((image_angle mod 180)-90)/90*acceleration;
var ya = image_angle + 90
ya = (ya + 360) mod 360
yaccel = ((ya mod 180)-90)/90*acceleration;
if image_angle < 180 {
xaccel = -xaccel;
}
if ya < 180 {
yaccel = -yaccel;
}
//speed
xspeed += xaccel;
yspeed += yaccel;
x += xspeed;
y += yspeed;
GML:
if spd > speedlimit {
xspeed -= sign(xspeed)/something
yspeed -= sign(yspeed)/something
}
else {
xspeed += xaccel
yspeed += yaccel
}
any help should help ( i'm quite new to programing )