Collision won't send boolean to false

Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
I'm trying to get a boolean to go to true on collision then false when no longer colliding but it just stays stuck at false.

This is the logic I'm using: http://i.imgur.com/MaX45.png

If(collide){boolean is true}else{boolean is false}

I'm not sure why it always returns false when it collides does anyone have any idea what I'm doing wrong? Thanks.

Best Answers

  • SocksSocks London, UK.Posts: 12,822
    edited December 2012 Accepted Answer
    As a quick debug test can you throw the 'otherwise' condition into a timer - and place it on 'after 0.5 seconds' (or enough time for the 'self.add/true' to register).

    The 'true' might be registering but immediately moving on to the 'false' bit.

    Just a guess, might not be relevant.
  • SocksSocks London, UK.Posts: 12,822
    Accepted Answer
    The method works fine for me (true as the rule and false as the 'otherwise')

    A quick example:

    http://www.mediafire.com/?mryafaogw7b8w8l

Answers

  • hotMagichotMagic Member, PRO Posts: 266
    Is it registering the otherwise event at all? Have you tried a debug msg?

    If not, a workaround is to make it switch that bool to false when the actor is outside the range of X distance from the other.
  • Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
    I did the debug log and it kept registering as false even when I'm inside collision.

    How would I phrase the distance part?

    If actor a is > x distance (I would have to get a variable here to calculate distance) then set to false

    then another rule that just sets it to true on collide?

    Thanks so much for the help!
  • Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
    I actually did that with the timer that's how I'm getting it.

    The other reason I know is I have some graphical things that trigger on true which go fine if I have nothing in the otherwise statement. Thanks for the help though.
  • SocksSocks London, UK.Member Posts: 12,822
    I actually did that with the timer that's how I'm getting it.
    I can't see a timer in your image of your rules ?


  • Goodnight GamesGoodnight Games NYCMember, PRO Posts: 184
    Oh man I'm dumb for some reason I read that and thought you meant putting a debug log in a timer (What I had already).

    I tried it and it worked, you are a gentleman and a scholar!
  • SocksSocks London, UK.Member Posts: 12,822
    Oh man I'm dumb for some reason I read that and thought you meant putting a debug log in a timer (What I had already).

    I tried it and it worked, you are a gentleman and a scholar!
    I'm guessing the collision was too brief to register before the 'otherwise' rule kicked, delaying the 'otherwise' rule gives it time to register. This is a guess by the way, but it sounds like the timer helped whatever the issue is.
Sign In or Register to comment.