H
Hadin
Guest
So I thought I'd moved past these problems but I guess not and I'm not finding anything online that helps. I added a roll/dodge ability and animation to my character but can't for the life of me figure out how to make it only happen once. I tried all variations of key check pressed and released. Only regular key check plays the animation in full so have stuck with that configuration. Can anyone please help explain how to make events only trigger once each time the correct buttons are pressed.
In the create event of player:
So it's a basic set up to get him to move towards where I want and keep the angle consistent with the direction I'm moving but as long as the buttons are pressed, the animation continuously plays. I've tried putting an animation End with an if statement saying if image index is > 0 and < 4, switch back to walk animation. I've tried using a similar method directly in the step event as well. I just don't understand how it all works together I guess and how and when to tell it to revert back to its walking animation. Please, any help would be greatly appreciated.
In the create event of player:
Code:
target_x = mouse_x;
target_y = mouse_y;
In step event:
if(keyboard_check(ord('W')) && keyboard_check(ord('D'))){
sprite_index = spr_dodge_roll;
image_speed = .6;
image_angle = direction;
if(point_direction(x, y, target_x, target_y) < 20{
move_towards_point(target_x, target_y, 6);
}
}