Collision editor

comport9

  • Posts: 51
How do you edit the bounding box in the collision editor? All I seem to be able to do is add shapes to it. I want to at least be able to delete/remove shapes, but I'd also like to be able to change the bounding-box vertices.

Thanks.

Edit: Just figured out that you have to hit the "delete" key. Um, wouldn't right-click "delete" make a lot of sense here? Or how about a garbage can to drag the shapes to...?

One more Edit: Ok, I figured out the "polygon" thing. However, the bounding-box for where it detects the cursor is still the square. (The full sprite...) I want it to be JUST the image. (In this case, a circle).

« Last Edit: December 24, 2012, 02:24:38 pm by comport9 »

captaincomic

  • *
  • Posts: 6108
Yup, the mouse events are detected on the size of the sprite by default. There is a Mouse Events on Visible Pixels on StencylForge that should do what you want.

comport9

  • Posts: 51
Thanks, I downloaded that one and the "...On Collision Shape". But neither seem to be working properly. It says something about "within another behavior", what does that mean? I just added them to the actor (And tried changing the collision box).

captaincomic

  • *
  • Posts: 6108
Okay, they are from an older version and don't seem to work anymore. To fix them, create a custom code event and copy the code from "when created" to it. Then remove the bracket } at the beginning, and add it at the end of the code.

So instead of this in "when created"
Code: [Select]
}
public function onActorPicked(actorPicked:Actor):void
{
if(!_ActorFound && (sameAs(actorPicked, actor)))
{
_ActorFound = true;
}

put this
Code: [Select]
public function onActorPicked(actorPicked:Actor):void
{
if(!_ActorFound && (sameAs(actorPicked, actor)))
{
_ActorFound = true;
}
}
in a custom code event (for Mouse Events on Collision Shape.)

comport9

  • Posts: 51
Code fails when making the change.

captaincomic

  • *
  • Posts: 6108
I uploaded the fixed behaviors to StencylForge as "Mouse Events on Collision Shapes/Visible Pixels Updated".

comport9

  • Posts: 51
Thanks! I guess I just don't understand how to use it though. What does "...from within another behavior, use it's custom blocks to check for mouse events".

I've attached it to my actor, but I don't understand what I have to do after that. BTW, I'm using "drag & drop" if that's important.

captaincomic

  • *
  • Posts: 6108
The behavior comes with some custom blocks. You can find them in the palette under Custom.
If you want to use this behavior with drag and drop you'll have to modify the drag and drop behavior and replace all the "if mouse was pressed/is down/etc." with the custom blocks from the mouse events behavior.

comport9

  • Posts: 51