Detecting collision (or lack of) of blocks next to each other.

Sunflower

  • Posts: 591
Alright, it's on Forge as Redpesto Example. You can check it out. Fun fact: some of the parts I got from already existing Snake Kit. ^^'

But yes, I hope it gives you the general idea how to do it. ;)

Oh, and in the Scene event I included restarting level through Enter button!

hansbe

  • Posts: 262
Very nice Sunflower! :)

redpesto

  • Posts: 134
Alright, it's on Forge as Redpesto Example. You can check it out. Fun fact: some of the parts I got from already existing Snake Kit. ^^'

But yes, I hope it gives you the general idea how to do it. ;)

Oh, and in the Scene event I included restarting level through Enter button!

Wow! Thank you :D - I've just had a look and it'll take me a day or two to work out exactly what is going on here but just knowing it works has given me an end goal  8)

Play

  • Posts: 165
I realize this has been solved, but couldn't you achieve what redpesto was looking for by simply creating boolean attributes which detect if the top, bottom, left or right was hit in a collision event, and then defaulting them to false at the end of the always event which detects which blocks are missing? The only thing it wouldn't do is detect if the brown boxes diagonal to the blue one are alive or dead, but you add those in using a simple sensor actor system.

Example:

Collision event:
If bottom/top/right/left of actor is hit
--set <bottom/top/right/left hit> to true

Always event:
If not <bottom/top/right/left hit>
--set <bottom/top/right/left block dead> to true
set <bottom/top/right/left hit> to false

I haven't looked at the solution given, however, so this might be a redundant question.

captaincomic

  • *
  • Posts: 6109
Yes, this would probably work as well. It's just that Sunflower's solution is more efficient because it doesn't rely on collisions and Box2D.