How do I register a collision with an animation?

0 favourites
  • 9 posts
From the Asset Store
4 Block Soldiers with different animations, 400x400
  • Hi, I am making a game where my character does an attack and hits a stationary object. On the collision/overlap I want the object to start a 'breaking' animation. Since my character's collision polygon is changing throughout the attack animation I can't seem to get it to work. The only way the break animation plays is if the character is already touching the object when the animation begins. Any suggestions would really be appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would just say player is overlapping object, and attack anim is playing, then play object breaking animation. It sounds like you've already done that here so I don't fully understand the problem.

  • As you mentioned, your collision polygon changes each frame of the animation.

    Consider making it as consistent as possible between frames. Try to have it the same shape and surface in order for the collision to be "consistent".

    You also should post your project for investigation, that would makes things easier to see the issue and be able to find out what is exactly going on, in regards to how you did set up your project.

  • Thanks so much, folks. I am completely new to this. Can either of you tell me how to post my project?

    Thank you again to both of you!!!

  • I am not sure why I feel like this should be simpler than it is. I am doing what you said, Plinkie, and it only works if I am overlapping when the animation begins. I believe that it has to do with the animation changing the collision polygon, but I can't figure out why that matters. Thanks again.

  • Well, it matters because collision polygon determines the overlap.

    If that bothers you just set the square/rectangle polygon on frame 1 , right click and apply to the whole animation, than it won't change.

  • Yeah so you must not be overlapping the object at that point when you move in to hit the object, and by overlapping I mean the collisions are overlapping not the visible object. As mentioned above check your collision but you knew that was a bit off anyway as seen in original post! :P

  • Thanks again. I know the polygons are overlapping at some point in the animation because the character's polygon goes through the object, but I am trying to figure out why it doesn't register the overlap at later frames in the animation (only if they are overlapping on frame 1).

  • Are you sure collision polygon is the same on every frame in the animation?

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