How do I "continue after animation completed"?

  • How do I: (a) on collision, (b) change animation of object, and then (c) wait until that animation (15 frames) fishes before continuing?

    I have (a) and (b) but am looking for the solution to (c)... I have tried a "wait 0.5 seconds" and this works but it is klunky. :-) Is there a better way: "wait to end of animation", "play after frame 15", etc?

  • You could put your character control events into a group in the events sheet and then:

    on collision with object: disable group (so player can't control character)

    play animation

    on animation finish: enable group (reinstate controls)

  • I cant disable the player collision because they are being "attacked" by multiple enemies - so I want the collision to be active in case they collide with a second enemy "while" the first collision enemy animation is playing. So for example - player collides with enemy 1, the enemy 1 death animation plays, then when animation finished, score is increased by 1. While that animation 1 was playing the played collided with a second enemy. So the second enemy death animation starts (before completion of the first enemy animation)... The real problem I am having actually deals the the SCORE... As the player collides with the enemy AND while the death animation is playing, the score rings up multiple hits (I have it coded as "Score = Score + 1". So instead of adding 1, it may add 2 or 3 to the score sometimes... (BTW, I already tried the TRIGGER ONCE WHILE TRUE and it doesn't fix the issue)

  • I can give you an easier solution to the problem.

    You can resolve this with so many different ways by adding another condition to the collision.

    If "Trigger Once While True" doesn't work then you do have more options.

    See what is the state of player sprite where you want it to work. I'd guess it's the first Animation. So you can have a condition: "On Collision Sprite1" and "Sprite1 animation default playing".

    Or, what about Frame number? you can also work with that. You can even change the opacity to 99 once collided, and in condition you can check "if opacity = 100".

    Or, you can "Disable collision" of that object immediately on collision, that way it won't detect collision multiple times.

  • Creative solutions! I will try and report back.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Note: In the description below, Obj A is the static object at the bottom of the screen and obj B are objects falling from the top of the screen in a space-invader like style.

    OK - a creative solution - When the collision (between Objs B and Obj A) would happen, I switched the animation (in B) to from "alive" to "die" but sometimes I would get two and three registered "hits" which made my score go up inaccurately (one point per hit). So some hits would register 2 or 3 therefore giving me multiple points - which was not my intention. One collision = 1 hit = 1 point. I was disabling collision on hit and this still did not work (as well as Trigger Once While True) so we out smarted it old-school style based on the comments and creative thinking in the above suggestions(?)

    SOLUTION: When the collision happens, the animation shifts to "die" and in the die animation, I made the collision area 2x2 pixels and tucked it in the bottom right hand corner, thus preventing a second collision from happening. I moved the collision area on Obj A "alive" up slightly so that when a collision happened the "die" collision was already below the Obj A thus making it impossible to hit a second time. I have tested this with dozens of falling Obj Bs and it is spot on accurate. (and no complicated code was required).

    Thanks for the assistance Lesley and Dr Hasan.

  • You could put your character control events into a group in the events sheet and then:

    on collision with object: disable group (so player can't control character)

    play animation

    on animation finish: enable group (reinstate controls)

    faced problem while doing so is there any other alternative???

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