Windows Programming recoil on the player

Basically, I'm trying to make a game that revolves around using the recoil from a gun to propel the player in whatever direction is opposite from where the gun is aiming. The firing itself works fine, but I can't quite figure out how to get the recoil to work the way I want apart from an animation on the gun. For reference here's the code I have for the blaster/gun

//Angle
image_angle = point_direction(x, y, mouse_x, mouse_y);

if (image_angle > 90) && (image_angle < 270)
{
image_yscale = -1;
playernaut_obj.image_xscale = -1;
}
else
{
image_yscale = 1;
playernaut_obj.image_xscale = 1;
}

//Firing
delay = delay - 1;
recoil = max(0, recoil - 1);
if (mouse_check_button_pressed(mb_left)) && (delay < 0)
{
recoil = 4;
delay = 5;
with (instance_create_layer(x, y, "Bullets", bullet_obj))
{
speed = 25;
direction = other.image_angle + random_range(-1, 1);
image_angle = direction;
}
}

x = x - lengthdir_x(recoil, image_angle);
y = y - lengthdir_y(recoil, image_angle);

I'd post a screenshot but it's apparently too large a file size to post.
Even if you can't help, I appreciate you taking a look at this regardless!
 
The firing itself works fine, but I can't quite figure out how to get the recoil to work the way I want apart from an animation on the gun. For reference here's the code I have for the blaster/gun
Based on that line, I suspect the problem is that you're moving the gun and not the player. Assuming "playernaut_obj" is the player object make the following change:

GML:
playernaugt_obj.x -= lengthdir_x(recoil, image_angle);
playernaugt_obj.y -= lengthdir_y(recoil, image_angle);
 
Top