T2008
Member
So, I've had a lot of trouble with the animation end event. Right now, I've tested my jump code and the animation end event never triggers. Through debug, it shows that the last two frames of the sprite are never shown and I have no idea why. I can only get the animation to stop at image_index 5, never playing the remaining frames. I"ve used floor(image_index) and that doesn't fix the problem.
I've searched around and other people have had this problem. Is there anyway to fix? this is so frustrating.
Edit: After much experimenting, I added the below code in step event. I added the floor image index == 5 because it wouldn't play past 5. This seems to work okay. Still I have to jump over a frame which I prefer not to do. Any better ways than this?
I've searched around and other people have had this problem. Is there anyway to fix? this is so frustrating.
Edit: After much experimenting, I added the below code in step event. I added the floor image index == 5 because it wouldn't play past 5. This seems to work okay. Still I have to jump over a frame which I prefer not to do. Any better ways than this?
Code:
var end_frame = 7;
if ((sprite_index = spr_player_jump_w) ||
(sprite_index = spr_player_jump_e) ||
(sprite_index = spr_player_jump_n) ||
(sprite_index = spr_player_jump_s)) {
if (floor(image_index) == 5) {
image_index = end_frame - image_speed;
}
if (image_index >= end_frame - image_speed) {
global.jump = false;
image_index = -1; //stops animation
//image_index = 7; //added so shows last frame of jump
z = 0;
player_direction_sprite_stopped();
jump_sound_played = false;
}
}
Last edited: