Rule checked only once by collision

ludoFludoF Member, BASIC Posts: 5

Hi there,

I'm new here and english is not my native language, so I apologies if I do mistakes...
I have an issue with the game I try to do.

Basically I have one actor "player" which can collide with 2 actors "walls".
Each actor "wall" as an attribute "selected" which change between 0 and 1 each time it collide with my player. Only one can have the value 1.
The goal is that the player collide only with the one with the value 1. When it collides with the one with the attribute 0 it should end the game and change the scene to the game over scene.

My issue is when the player collides with the wall with the value 1, the collision make it changes to the value 0 (perfectly normal) but also trigger the game over scene which I want to avoid. I want it to trigger this scene only if the wall had the value 0 before the collision with the player.
So basically I would like my rule to trigger (or not) the game over scene applying only for one collision and as soon there has been a collision, it stop to check the value of this wall until the next collision.

As I don't know if it's clear, I'll try to explain differently what it should be:

Player collides with wall with value 1 -> change the value randomly between 0 and 1 -> stop.
Player collides with wall with value 0 -> Game over.

For now it's more like this:

Player collides with wall with value 1 -> change the value randomly between 0 and 1 -> if it's still 1 nothing happens as it should. If it changes to 0 the game over is triggered.

Hope it makes sens...

Thank you!

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    My issue is when the player collides with the wall with the value 1, the collision make it changes to the value 0 (perfectly normal) but also trigger the game over scene which I want to avoid. I want it to trigger this scene only if the wall had the value 0 before the collision with the player.

    Try this . . .

    When player hit wall . .
    --Timer / after 0.1 seconds
    ----Change wall value to 0

  • ludoFludoF Member, BASIC Posts: 5
    edited November 2016

    Hi Socks,
    Thanks for your answer, I tried what you suggest but it does not work and it breaks my random distributions of value.

    As I might have done something wrong in the rest of the project, maybe it will be better with an example.

    You can download it here.

    For now only the wall on the right have the rule to change the scene to Game Over so it will only work on this one.

    Thanks

  • SocksSocks London, UK.Member Posts: 12,822

    I've attached a simplified project - it seems to work fine for me, not sure if this is what you wanted, but it might be useful nonetheless.

  • ludoFludoF Member, BASIC Posts: 5

    Thanks, It's doing what I am looking for!
    You build it differently so I will have to see how to adapt that to my project but thanks!

Sign In or Register to comment.