Solved Stage Animated Effects (Fire, Rain, Fog, etc..)

Question that is answered or resolved.

mulambo

Member
Is there a way to display effects, possibly with alpha channel/transparency ?
I mean, if i have gif like this
serveimage

and I want to place it on certain parts of the stage (so the black part is seen as alpha channel, transparent), what should I do ?
Same goes for non-animated gifs, but moving objects/layers in transparency, like fog
serveimage

and I want it to be tiled and moving from right to left on top of the other stage layers?
 
I think for the flame jet, one could use GIMP and the "by color select" with a threshold of 0 to select the black color and change it to Magenta, set the image to use a 256-color pallette with magenta as the first color, and then export the animation. Then make an object for the flame, and set it as a "trap" with a hitbox that deals "burn" damage to those who step on it, and have the animation play as "ATTACK" There is a script command to play GIF images in the engine as well. One can also use the same thing for the fog, and make the magenta transparent. Display it with "alpha 1" as a "panel" in the engine.
 
Miru said:
I think for the flame jet, one could use GIMP and the "by color select" with a threshold of 0 to select the black color and change it to Magenta, set the image to use a 256-color pallette with magenta as the first color, and then export the animation. Then make an object for the flame, and set it as a "trap" with a hitbox that deals "burn" damage to those who step on it, and have the animation play as "ATTACK" There is a script command to play GIF images in the engine as well. One can also use the same thing for the fog, and make the magenta transparent. Display it with "alpha 1" as a "panel" in the engine.
can you provide the code if it's not too much effort?
about the fog and non-attacking stage elements such as rain or fog?
 
Same goes for non-animated gifs, but moving objects/layers in transparency, like fog

You can use fglayer command
Code:
fglayer         {path} {z} {xratio} {zratio} {xposition} {zposition} {xspacing} {zspacing} {xrepeat} {zrepeat} {transparency} {alpha} {watermode} {amplitude} {wavelength} {wavespeed} {bgspeedratio}

to set fog like this:
Code:
fglayer 	data/bgs/swamp/Gmist.png 12 0 0 0 -70 0 0 -1 1 1 1

fglayer command allows the sprite to be tiled, just play around with {xposition} and {xspacing} parameter

and I want it to be tiled and moving from right to left on top of the other stage layers?

for moving, you need a simple trick :
1. set bgspeed to autoscroll background and fglayer & bglayer which are set to autoscroll too
2. Since you don't need to background to autoscroll, use bglayer as background

Here's an example:
Code:
background	data/bgs/forest1/darkback2.png
bglayer		data/bgs/forest1/darkback2.png 0 0 0 0 0 0 -1 1 1 0 0 0 0 0 0
panel		data/bgs/forest1/darkpanel.png
fglayer 	data/bgs/swamp/Gmist.png 12 0 0 0 -70 0 0 -1 1 1 1 0 0 0 0 -0.7
bgspeed		1

In this example, fglayer is set to autoscroll with background. There's a bglayer using same image as background to give illusion that background isn't autoscrolling
 
Bloodbane said:
Same goes for non-animated gifs, but moving objects/layers in transparency, like fog

You can use fglayer command
Code:
fglayer         {path} {z} {xratio} {zratio} {xposition} {zposition} {xspacing} {zspacing} {xrepeat} {zrepeat} {transparency} {alpha} {watermode} {amplitude} {wavelength} {wavespeed} {bgspeedratio}

to set fog like this:
Code:
fglayer 	data/bgs/swamp/Gmist.png 12 0 0 0 -70 0 0 -1 1 1 1

fglayer command allows the sprite to be tiled, just play around with {xposition} and {xspacing} parameter

and I want it to be tiled and moving from right to left on top of the other stage layers?

for moving, you need a simple trick :
1. set bgspeed to autoscroll background and fglayer & bglayer which are set to autoscroll too
2. Since you don't need to background to autoscroll, use bglayer as background

Here's an example:
Code:
background	data/bgs/forest1/darkback2.png
bglayer		data/bgs/forest1/darkback2.png 0 0 0 0 0 0 -1 1 1 0 0 0 0 0 0
panel		data/bgs/forest1/darkpanel.png
fglayer 	data/bgs/swamp/Gmist.png 12 0 0 0 -70 0 0 -1 1 1 1 0 0 0 0 -0.7
bgspeed		1

In this example, fglayer is set to autoscroll with background. There's a bglayer using same image as background to give illusion that background isn't autoscrolling
thanks! can you post the gmist.png image so I can use it as reference?

::edit::
nvm, the fog worked just fine!

::edit2::
at Miru thanks a lot again, can you provide an example of code for the "trap" entity I want to show with alpha transparency?
also it seems that it's only attacking once. how to make it attack infinite (as it would be normal fire) ?

 
also it seems that it's only attacking once. how to make it attack infinite (as it would be normal fire) ?

You need to loop the animation + add attack 0 to reset attack like this:
Code:
anim	idle
	loop	1
	delay	10
	offset	10 30
	attack	0 2 18 28 10 1 1 1
	frame	data/chars/traps/duri.png
	attack	0
	frame	data/chars/traps/duri.png
 
Bloodbane said:
also it seems that it's only attacking once. how to make it attack infinite (as it would be normal fire) ?

You need to loop the animation + add attack 0 to reset attack like this:
Code:
anim	idle
	loop	1
	delay	10
	offset	10 30
	attack	0 2 18 28 10 1 1 1
	frame	data/chars/traps/duri.png
	attack	0
	frame	data/chars/traps/duri.png
yup, tried that , but I think it's an engine thing or I don't know, the manual says that "trap" entities only hit once... so I've just decided to make it as simple obstacle with no bbox, not hittable and not hitting. least of the worst  :/
 
the manual says that "trap" entities only hit once...

Hmmm....

Code:
If a trap is not set up to knock the entity down, the trap will only damage the entity one time. To hit them again, the target entity must take damage from another entity.

I forgot why it says something like that  :-\ . Maybe noone spotted that
Anyways, since traps are so simple, I usually use type none instead of type trap to make traps

so I've just decided to make it as simple obstacle with no bbox, not hittable and not hitting

:(
Can I see the whole text of this flame trap?
 
Bloodbane said:
the manual says that "trap" entities only hit once...

Hmmm....

Code:
If a trap is not set up to knock the entity down, the trap will only damage the entity one time. To hit them again, the target entity must take damage from another entity.

I forgot why it says something like that  :-\ . Maybe noone spotted that
Anyways, since traps are so simple, I usually use type none instead of type trap to make traps

so I've just decided to make it as simple obstacle with no bbox, not hittable and not hitting

:(
Can I see the whole text of this flame trap?

Code:
name	firest1
health	1
type	trap
gfxshadow 0 #	0
icon	data/chars/misc/baricon.gif
diesound data/sounds/wood.wav
nolife 1 
alpha 1 
nomove 1
setlayer 7

anim idle
	loop	1
	delay	8
attack 0 0 200 300 12 1
	frame	data/chars/misc/firest1b1.gif
 	frame	data/chars/misc/firest1b2.gif
	frame	data/chars/misc/firest1b3.gif
 	frame	data/chars/misc/firest1b4.gif


so I changed it back to trap because ( I don't know why) the flames showed on the back of bg (behind the wrecked cars), the player can walk on fire (lol, kinda cool though), but ok, it's fine for me. I've also tried to put a wall so the player can't just move where the fire is, but maybe i coded it wrong as it's not working.
 

Attachments

  • EMPTY - 0002.png
    EMPTY - 0002.png
    88.5 KB · Views: 11
Ah my thought is correct, you forgot an important detail. You need to turn off attackbox before looping like this:
Code:
anim idle
	loop	1
	delay	8
attack 0 0 200 300 12 1
	frame	data/chars/misc/firest1b1.gif
 	frame	data/chars/misc/firest1b2.gif
	frame	data/chars/misc/firest1b3.gif
attack 0
 	frame	data/chars/misc/firest1b4.gif

That's how to make trap which can hit multiple times :)

the flames showed on the back of bg (behind the wrecked cars)

type doesn't affect position. Seeing setlayer command there makes think that's the real cause. Setting negative setlayer will put entity behind panels
 
thanks, gotta try it
one more questions about it: for now I've only tried attacks with one box, can the attack in this case have more boxes/rectangles, as you can see the attack box should be like made of 3 rectangles (one vertical, one horizontal, another one to fill the central part between them). In this case do I just add the "attack" line with different values or only one works?
I've added the setlayer  just to be sure because, without it (maybe because of the complex stage having the fog layer or something) it only showed behind the double bg (that was the tweak to make the fog move horizontally), it wasn't a negative number before
 
Internally, yes, openbor supports an unlimited number of collision boxes and has for quite a while. But up until recently I hadn't decided on the text command format for you to use them. So they aren't available just yet, but will be very soon.

DC
 
I forgot to answer this:

mulambo said:
I've also tried to put a wall so the player can't just move where the fire is, but maybe i coded it wrong as it's not working.

You can use wall to block the fire but that would be inefficient if you place more than one fire. Instead you should use platform command to block the fire
 
yup, I found out platforms on the manual, they're a bit complex though. I think I'll use them someday, currently I mostly use holes to give the game more action and difficulty. about the fire, I think I'll leave it like that, after all it's just a minor problem. or I'll just leave the fire in unreachable areas of the game until I really understand how to make it attack the player, but that's not high priority for now. Thanks for all your help!
 
Back
Top Bottom