I'm struggling to implement this into an asteroid-like game that uses motion_add for movement based on image rotation/angle because the script's _mv_spd expects an integer but I add movement simultaneously to direction and speed. If I separate the values, then speed increases exponentially regardless of direction... but I only want +/- speed in the player object's direction of movement.
Any help would be greatly appreciated!
Ship Create
vardirection=direction;
varspeed=speed;
//Movement Script
movement_and_collision(vardirection,varspeed,obj_wall_base);
//Add movement in direction
if (keyboard_check(vk_left) or keyboard_check(ord("A")))
{
sprite_index = spr_shipa;
vardirection=image_angle+90;
varspeed+=1;
}
if (keyboard_check(vk_right) or keyboard_check(ord("D")))
{
sprite_index = spr_shipd;
vardirection=image_angle-90;
varspeed+=1;
}
if (keyboard_check(vk_up) or keyboard_check(ord("W")))
{
sprite_index = spr_shipw;
vardirection=image_angle;
varspeed+=1;
}
if (keyboard_check(vk_up) or keyboard_check(ord("W")))
{
sprite_index = spr_shipw;
vardirection=image_angle;
varspeed+=1;