How to make a "not colliding with" behavior?

AwesomePassword

  • Posts: 104
So, when a character(Bolt) is colliding with a cube, then it will disable one of his behaviors(not the same behavior that is disabling the behaviors, of course). When he is not colliding with the cube, then the behavior will be re-enabled. The problem is, there is not a "when actor is not colliding with" block; there is only a "always" and "when actor is colliding with block". Thus, I don't know how to make it work. When Bolt collides with the cube, then it will disable the behavior. But it needs to re enable when the player is not colliding with it. How? If I place it in the always block, the always block overrides the collision block and the behavior will not disable at all. So I don't know what to do! :'(

Any feedback and solutions would be greatly appreciated.

~Password
===
Games:
-Tetra Factory - 80%

Tuo

  • *
  • Posts: 2469
The quick answer is to put an attribute setter at the END of your "always" coding so it is defaulted to that value. Then, when you have a collision, set that attribute to a different value to be used elsewhere in the coding. To disable a coding then, just place it inside of an "if" that checks to see if the attribute is defaulted or otherwise.

Both Abigayl and myself used this strategy in our platformer games if you want to see how it works. Hers are on Kongregate (http://www.kongregate.com/games/Abigayl/stencyl-2-0-tutorial-2-jumping) and mine are in StencylForge (search for "Demo-" to find them all).
Don't look to me but rather to the One who is the reason for what I do. :)

If you need help, send me a PM. Even if I haven't been on in the forums in ages, I still receive those messages via email notifications. You can also reply to any of my forum posts, regardless of the age (especially if I created it), and I will likely reply.

If you want to see the programming behind certain types of games, feel free to check out my "Demo-" games on StencylForge (http://community.stencyl.com/index.php/topic,16160.0.html)

Innes

  • *
  • Posts: 1960
Someone helped me out with some great 'not colliding code' a few weeks (possibly months) ago, but I just can't find the thread.

I think it may have been Tuo.
Visit www.TheStencylBook.com - the only published book for learning Stencyl.

twotimingpete

  • *
  • Posts: 1667
I always wished you could put "if colliding with" then "otherwise" but that never seems to work ;)