How do I cause a moving sprite to stop on impact?

0 favourites
  • 5 posts
From the Asset Store
This is a code so you can see the same skin on all screens (peers). Each peer gets a skin, in addition to 4 directions t
  • Hello my fellow Construct users,

    I'm creating a game where I need to make projectiles (such as missiles) move and then explode on impact. My current problem is that once the missile makes impact with the intended target, the explosion animation plays but it keeps moving in the same trajectory of the missile before it exploded.

    I realize that this may sound a bit complicated so I'll try and elaborate a bit more. I have a target on the ground, and I want a missile to hit it, but once the missile hits, I want it to trigger the explosion animation while staying in the position it was in upon impact.

    I really hope this makes sense, and thank in advance!

  • Have you put the explosion's animation in the sprite of the missile?

  • Yes I added all necessary animations to the sprite of the missile. However, the missile which is supposed to be flying towards the target, once it makes impact with the aforementioned target, the explosion animation plays but then the explosion flies off screen.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • *missile on collision with wall(or object you want):

    ---missile set speed to 0

    ---missile set acceleration to 0 (if missile.acceleration>0)

    ---missile play animation "explosion" (play from beginning)

    *missile on animation "explosion" finish:

    ---missile destroy

    or

    add new sprite with explosion only then

    *missile on collision with wall(or object you want):

    ---missile spawn sprite"explosion" at imagepoint 0

    ---missile destroy

    *"explosion" on animation finish: explosion destroy

  • Thank you so much! You're awesome!

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