sprite collision test too early in C3

0 favourites
  • 4 posts
From the Asset Store
Soldiers` Test
$12.99 USD
A Construct version 2 & 3 "Stand-alone" RPG game with "In-Game Module" (IGM) integration.
  • am implementing a ricochet example where if a bullet hits the shooter, the sprite dies or score decrements.

    the problem is that bullets overlap the shooter initially so the collision condition is true immediately.

    should collision tests be deferred until the bounding rectangle is cleared?

    I moved the image points outside the bounding rectangle to fix the problem, but it doesn't look as good.

    Any other suggested fixes?

    thx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Give the bullet an instance variable, set to false. When you fire it, set the instance variable to true. On the collision event have a condition for if instance variable is true then take the damage. Basically you are checking that the bullet is in its rebound state when it hits the player.

  • you gave me the solution idea. thx.

    however, couldn't the instance set on shooter firing mess up if bullet stays inside shooter rectangle for more than 1 tick?

    since ricochet can only occur after hitting a barrier,

    i'll set to false when shooting, but set to true when a bullet hits a barrier.

    then if a bullet hits the shooter with instance false it must still be firing and can be ignored.

  • Yeah that sounds fine, I can't see your game so was just giving a general solution. It's up to you to decide when you want to toggle that variable and when it hits the barrier seems correct.

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