[SOLVED] Animation Won't Trigger?

0 favourites
  • 13 posts
From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
  • I'm trying to get my "Down" animation to trigger when Health is at Zero. The Restart Layout and so forth actions work, but the animation does not. When I go to debug, it shows the "Down" animation is playing in the system, but in the preview it is not. I've tried various methods to get it to work, but have failed at each turn (I even went and sped up the Down Animation hoping it would trigger as well as add a Wait Action for 0.1 to give the system a chance). Anyone have a guess as to why it is not working? (My player is set to the PF_Movement sprite object which has the Platform behavior). I've even tried it without Event 102.

    Thanks!

  • Can you share your project? Will try to fix it here..

  • I would, but it has 2/3 of everything completed (well, except zero sound). I understand it would be easier to see the whole thing, but at this stage I can only share images. It’s the last of the animations. The loss of health and restarting layout once health hits zero works. The system plays the Down animation, just doesn’t go through the frames to view it.

    If I can’t figure it out, I may leave as is.

    Thank you.

  • change pixel-health = 0 to

    , i think your animation is not triggering cause the health value is never 0 is either above 0 or less than zero. like -2 or -1.

    can i see where you subtract from health? is it based on collision? does it trigger once? or is it based on overlaping? cause latter will not trigger just once but 2-3 times as long as the other sprite is overlaped in 1 -2 tick. to travel over.

  • GeorgeZaharia

    Cloud isn’t brining up my project on mobile. I can post a pic when home.

    I have a condition where any collision with an “Enemy” or a certain object and player isn’t flashing to Flash for 2 second.

    If player is flashing, trigger once to subtract one from Global Variable Pixel Health.

    My Health HUD is set to change frames based on amount of Pixel Health there is and that has worked smoothly and I don’t think is causing the issue.

    It’s weird because in the Debug, My player shows Down animation supposedly playing, just doesn’t actual show the player going through frames.

    I will try to post later.

    Thank you.

  • GeorgeZaharia

    Here you can see the Pixel_Health Global Variable stops at 0 (and the Health HUD in the upper left corner is black/the frame it should be). The Game then goes through the actions and restarts the layout.

    This is the image of whole health system.

    Here it is with changing the Pixel_Health to equal or less than 0.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Don't know why this didn't appear in my last post, but here is the image with health = or less than 0.

    This also shows the Pixel_Hero's current animation as it switched to Down. It has 4 frames where the last frame he is laying down. It doesn't go through any of the frames.

  • any chance the animation speed for Down is zero?

  • ok, try adding trigger once to the Pixel_health <= 0

    that event is continuously firing, constantly restarting the animation to frame 0... until the first time it hits the wait 3 seconds and restarts the layout.

  • AllanR I'm trying different variations. I gave a second of wait to disable the Jump otherwise anything less he is stuck in the air doing his normal jump animation, but that isn't the problem though. This is a tough one. I will keep trying. Thank you for suggestions.

  • I went a different route and solved it. I cloned my Pixel_Hero and just spawned him in place of the Original. When he appeared he plays the "DOWN" animation. When everything restarts, all objects, Health, variables, etc. reset to normal. I might tweak it a bit down the road, but I need to move on. I appreciate the suggestions I was given from the community. Everything helps to look at it from someone else's perspective.

  • staleevolution

    Hi!

    I've had a similar problem (I wanted to trigger an animation on a Sprite when a collision happened), spent hours and finally did what you suggested (spawned another object). So thanks!

    It really feels like a bug. If it's not I don't understand why you would have to find a "complicated" workaround for something that just should work (On collision=Play "" animation)!

    Anyway, thanks again :)

  • Don't know why this didn't appear in my last post, but here is the image with health = or less than 0.

    This also shows the Pixel_Hero's current animation as it switched to Down. It has 4 frames where the last frame he is laying down. It doesn't go through any of the frames.

    line 102, you had 2 conditions, on floor and health <= which health was ok, but platform was not, since your first action was to disable the platform behavior, which would turn the condition platform on floor as false. even tho the character was indeed on floor.

    while the behavior is disabled the condition related to it, it won't disable as well, it will still check for the platform value if its on floor, and since u disabled the behavior you get a NAN there or behavior doesn't exist while condition still exists.

    sorry for late response.

    the solution was to move the "platform disable action" under the down animation or on bottom of the list of actions of that condition set on line 102.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)