P
Purple_Shy_Guy
Guest
This is my first project, so I'm having a bad time trying to figure out how to do it. My knockback wasn't working somedays ago, and the community helped me, so it's working now. But I want to make a knockback just like the one in megaman, because I think it's really dynamic. This is the code I'm using now in the player's state (this is the code that it's working, and not my attempt do to the megaman knockback.):
Does someone know how to turn it into the megaman knockback or at least have an idea?
Code:
if place_meeting(x, y, Obj_Slug) && (cooldown<1) {
health = health - 1;
blink = true;
cooldown = 60;
}
cooldown = cooldown - 1;
if cooldown > 1 {
blink = true;
} else {
blink = false
}
nearest_slug = instance_nearest(x, y, Obj_Slug);
if (place_meeting(x, y, nearest_slug)){
knockback_direction = point_direction(nearest_slug.x, nearest_slug.y, x, y);
x += lengthdir_x(move_speed*15, knockback_direction);
y += lengthdir_y(move_speed*15, knockback_direction);
}