Mouse Events On Collision Shape [NOW AVAILABLE]

gamegirlxl

  • Posts: 713
The name of the behavior says it all: it detects mouse events on any arbitrary collision shape (for the  actor), and is not limited to the sprite rectangle.

It seems easy if you know what the collision shape happens to be.  I think that Box2D handles physics like that, but I wouldn't know where to start...

Maybe it would work if an actor that collides with buttons followed the mouse and it did things.  It could even be invisible.

Alexin

  • *
  • Posts: 3132
The behavior needs the list of collision shapes associated with a particular actor. Then, for each shape, it asks Box2D whether a point (the mouse coordinates) intersects that shape or not.
Since there are no blocks for any of that, I had to use code blocks and AS3.
"Find the fun"
alexin@stencyl.com

Alexin

  • *
  • Posts: 3132
I made a first attempt at this and ran into some issues, but haven't given up.
"Find the fun"
alexin@stencyl.com

Alexin

  • *
  • Posts: 3132
Available on StenylForge. Search for "Mouse Events on Collision Shapes".
"Find the fun"
alexin@stencyl.com

gamegirlxl

  • Posts: 713
The behavior needs the list of collision shapes associated with a particular actor. Then, for each shape, it asks Box2D whether a point (the mouse coordinates) intersects that shape or not.
Since there are no blocks for any of that, I had to use code blocks and AS3.
I assumed that that would be how it works.  There's essentially two types of shapes: triangles and circles (with rectangles being two triangles), so it might not be as intimidating as I might have thought.  It's more like finding if a point is within a range pspecified by the region, how I look at it.

pcmoreno

  • Posts: 43
It seems that this behaviour does not work on ver 3.3

Is there something equivalent I could use instead?