How do I make a player not die when no longer colliding with object?

0 favourites
  • 2 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • So I have a moving block pushing across the screen and when the player doesn't collide with it I don't want the player to die anymore. So here what I got

    Player on collision with player set variable 1

    (X)player on collision with player set variable 0

    Colliding with player = 1/ wait 3 sec/ destroy

    Colliding with player =0/ No event

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In other words, the player only dies if it continues to collide with the object for 3 seconds? Yeah, you should not use "wait" here.

    Try something like this:

    variable collisionTime=0
    
    On player collision with block -> Set collisionTime to time
    
    Player NOT overlapping block -> Set collisionTime to 0
    
    Every tick
    collisionTime not equal 0
    collisionTime less than (time-3) -> Player destroy
    

    You can also do the same with Timer behavior. On collision start a timer "die" for 3 seconds. If no longer overlapping, cancel timer. On "die" timer event, destroy the player.

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