Filter/Effects on entire Screen ( BlendMode for example)

148 views
Skip to first unread message

LuFe_Mas

unread,
Apr 5, 2016, 10:17:30 AM4/5/16
to HaxeFlixel
There is a way to apply a filter or effect on the screen image, not just a sprite? O Got the a FlxSprite reference on FlxCamera, but when I change the BlendMode the game crashes.

I just want to put some dark and misterous feel on my game.

sano98

unread,
Apr 5, 2016, 3:55:52 PM4/5/16
to HaxeFlixel
Hey LuFe_Mas,

I don't know about effects on the camer, but I've made good experiences with a combination of two things:
  1. My levels consist of several tilemaps layered over each other, and one (with dirt and bloodsplatters) uses the hardlight blendmode
  2. I am modifying the the .color-attributes of all sprites and tilemaps on the screen. Sounds expensive, but is done with just 3 lines of code and I didn't notice performance impacts so far.

You can check out some pictures of the result in this thread.

LuFe_Mas

unread,
Apr 5, 2016, 11:28:47 PM4/5/16
to HaxeFlixel
Thanks sano98, that´s is a good idea. I will see if a get a good effect.

But if I want something like this:


On the entire screen. There is no way?

sano98

unread,
Apr 6, 2016, 4:12:03 AM4/6/16
to HaxeFlixel


I guess you could take exactly that picture, make it the size of your screen, load it as a flixel sprite and put it over everything you have.
Then give it a scrollfactor of 0 so it always stays in the view.

If UI should not be affected by it, you can add that layer so that it will appear over this effect graphic.
Does that work for you?


var effect:FlxSprite = new FlxSprite(0, 0);
effect
.loadGraphic("assets/images/box-shadow.png");
this.add(effect);
effect
.scrollFactor.x = 0;
effect
.scrollFactor.y = 0;





I've added it to my game as a try:



Is that what you need?


LuFe_Mas

unread,
Apr 6, 2016, 12:28:08 PM4/6/16
to HaxeFlixel
Yes, after you said, became very simple. Thank you.


Em terça-feira, 5 de abril de 2016 11:17:30 UTC-3, LuFe_Mas escreveu:
Reply all
Reply to author
Forward
0 new messages