Glow filter??

CheezeyGames

  • Posts: 2
So, I'm trying to add a glow filter to my player. Here's how I implemented the code into the GlowFilter behavior:
Code: [Select]
package scripts
{
import flash.events.*;
import flash.net.*;
import flash.filters.*;
import Box2DAS.Collision.*;
import Box2DAS.Collision.Shapes.*;
import Box2DAS.Common.*;
import Box2DAS.Dynamics.*;
import Box2DAS.Dynamics.Contacts.*;
import Box2DAS.Dynamics.Joints.*;

import stencyl.api.data.*;
import stencyl.api.engine.*;
import stencyl.api.engine.actor.*;
import stencyl.api.engine.behavior.*;
import stencyl.api.engine.bg.*;
import stencyl.api.engine.font.*;
import stencyl.api.engine.scene.*;
import stencyl.api.engine.sound.*;
import stencyl.api.engine.tile.*;
import stencyl.api.engine.utils.*;
import org.flixel.*;

public dynamic class Design_1_1_ extends ActorScript
{
//Expose your attributes to StencylWorks like this
[Attribute(id="1", name="Display Name", desc="An Attribute")]
public var attributeName:String;

//Do all actor initialization here
override public function init():void
{
//How would I initialize my player?
}

//This is executed every frame of the game
override public function update():void
{
var glow:GlowFilter = new GlowFilter();
glow.color = 0x009922;
glow.alpha = 1;
glow.blurX = 25;
glow.blurY = 25;
glow.quality = BitmapFilterQuality.MEDIUM;
 
//What should go here?.filters = [glow];
}

override public function draw(g:Graphics, x:Number, y:Number):void
{
}

override public function handleCollision(event:Collision):void
{
}

//Leave this alone. Do your initializing inside init()
public function Design_1_1_(actor:Actor, scene:GameState)
{
super(actor, scene);
}
}
}
I'm a total newbie with ActionScript, so what should be put where those comments are?
The actor's name is Player.

Alexin

  • *
  • Posts: 3132
Download the pack Screen Effects and open the code mode behavior called DisplacementMap. You can use it as a base for the filter you want.

I highly discourage you of creating a new GlowFilter every step. Again, study the behavior mentioned above.
"Find the fun"
alexin@stencyl.com

CheezeyGames

  • Posts: 2
Still can't figure it out.
That's a displacement map filter, I'm looking for a glow filter. I wouldn't know how to adapt that, I'm new, remember.
So, really, how would I put that code into my actor?? (without making a new one every step)

Alexin

  • *
  • Posts: 3132
Done and up on StencylForge. Search for Glow Filter. Enjoy!
"Find the fun"
alexin@stencyl.com

Just wanted to pop in and say I tried the glow filter, but have yet to get it to do anything. It's attached to an actor and I've played around with some of the variables, but I can't see any effect. Any idea why that may be?

Reashu

  • Posts: 16
Just wanted to pop in and say I tried the glow filter, but have yet to get it to do anything. It's attached to an actor and I've played around with some of the variables, but I can't see any effect. Any idea why that may be?

I got it working pretty much out of the box. All I did was change the color to red, since my background is green...

Try values like (top to bottom): 1.0, 5, 5, white, false, false, 2, 2, because I have those working just fine right now.

Just restarted the program and now it works fine. I guess things just weren't updating right.

Alexin

  • *
  • Posts: 3132
Yeah, there's a bug that makes downloaded resources unrecognized until the app is restarted.

The behavior is nothing more than a proxy to the GlowFilter, provided with Flash. I didn't take care about ease of use or user-friendly values.

In fact, I suspect it may not work properly if the actor is scaled, rotated, etc. It also disables actor drawing when initialized, so if another behavior re-enables it the result may be different than the expected.

I'll gladly fix any bug you find.

"Find the fun"
alexin@stencyl.com

purplelava

  • Posts: 82
Alexin,

is the bug going to get fixed?

Jon

  • *
  • Posts: 17524
Yeah, there's a bug that makes downloaded resources unrecognized until the app is restarted.

There is? That's news to a lot of us.

Alexin

  • *
  • Posts: 3132
@purplelava
What bug?


Yeah, there's a bug that makes downloaded resources unrecognized until the app is restarted.

There is? That's news to a lot of us.
If the downloaded behavior is used, then the game starts but the console says the behavior is undefined. Restarting SW fixes the problem. This happened only once to me and I suppose it's the same bug some users have come across.

I can't find a specific thread about it, but I remember Greg (and maybe Justin too) took part in the discussion, which I didn't.
"Find the fun"
alexin@stencyl.com

purplelava

  • Posts: 82
@purplelava
What bug?


Yeah, there's a bug that makes downloaded resources unrecognized until the app is restarted.

There is? That's news to a lot of us.
If the downloaded behavior is used, then the game starts but the console says the behavior is undefined. Restarting SW fixes the problem. This happened only once to me and I suppose it's the same bug some users have come across.

I can't find a specific thread about it, but I remember Greg (and maybe Justin too) took part in the discussion, which I didn't.

Ehm...I'm talking exactly about THAT bug...the fact that after you download a resource you have to restart to make it work...isn't that a bug? This didn't happen to me only once, it happens all the time.

I saw other people have the same problem; I'm not going to say this makes the app useless but it really slows down the workflow TOO much, I can't believe this hasn't been addressed before release. Shouldn't they take care of it? I confused "Community Team member" for actual Stencyl developer, sorry. I should probably bring this to the development team.

Greg

  • *
  • Posts: 1260
We're aware of this issue and it's currently being looked into. 

http://community.stencyl.com/index.php/topic,1241.0.html

Alexin

  • *
  • Posts: 3132
This topic is about Glow Filter, so I supposed the bug was related to it.

A release doesn't mean every bug is known and fixed. That one in particular never showed up until now. Also, keep in mind we're volunteers, it's not like there are devs working on the tool full-time.
"Find the fun"
alexin@stencyl.com

spooneyte

  • Posts: 8
The Glow Filter works great, but, being a relatively newbie, it's the first piece of pure code I've encountered, and I'm not sure how to have it triggered. I.e., I'm making a board game, and I'd like the pieces to glow when moused over, which in Design mode is quite easy to set up. But I have no idea which chunk of code to copy into a block, or conversely where to cut and paste the mouseover command into the Glow Filter...