Draw to Layer in Actor Behavior in Design Mode (Code Block)

captaincomic

  • *
  • Posts: 6108
I created a behavior for the Drop Shadow Filter (flash.filters.DropShadowFilter), it's on StencylForge in the Eye Candy Pack.
The problem is the shadow gets drawn on the same layer as the actor, and therefore it gets drawn over other actors.

Is it possible to draw on a specific layer in an Actor Behavior using a Code Block in Design Mode?

I found http://www.stencyl.com/help/viewArticle/50, but it says it only applies to Scene Behaviors and also you need to override a function, which is not possible in Design Mode.

Thanks :)

Alexin

  • *
  • Posts: 3127
If it must be an Actor behavior and use Design Mode, then you must delegate drawing to a dummy actor placed in the desired layer. Not optimal but you don't have any other choice.
"Find the fun"
alexin@stencyl.com

coleislazy

  • *
  • Posts: 2607
You can override functions in design mode like this.

Note that you could also use blocks mixed with code, after the first line declaring the function.

coleislazy

  • *
  • Posts: 2607
Ok, so that should have been a scene behavior...

captaincomic

  • *
  • Posts: 6108
Ah ok, thank you both!

I didn't know you could just use a closing bracket to end the drawing block :)

I will try if I can get it to work with a dummy actor or a scene behavior...

captaincomic

  • *
  • Posts: 6108
Ok, doing it with a dummy actor was easy. It's not the most elegant solution, but for now, its ok. :) Maybe l try to do the other thing later.

captaincomic

  • *
  • Posts: 6108
Actually my dummy actor solution made more problems than it solved, so in the end I went with the scene behavior. I updated the Eye Candy Pack and added an example Eye Candy Pack Showcase ;)

« Last Edit: November 25, 2011, 01:30:00 am by captaincomic »