background entity

Gurtag

Active member
hey ppl, how do you spawn an entity as a background? allready set it as type panel and give it setlayer -9999 but no luck so far, it keep spawning front of all layers.
here the entity code:

Code:
name    lightrain
health  1
type panel
alpha     3
nomove 1
offscreenkill  3000
setlayer        -9999
subtype noskip
antigravity 100
palette   data/chars/clima/lightrain/1-3.gif
alternatepal data/chars/clima/lightrain/1-1.gif
alternatepal data/chars/clima/lightrain/1-1.5.gif
alternatepal data/chars/clima/lightrain/2.22.gif
alternatepal data/chars/clima/lightf1.gif
alternatepal data/chars/clima/lightrain/horsetrack1.gif
alternatepal data/levels/3-1/3-1bb.gif


anim	follow2
	loop	0
	drawmethod	remap 6
	drawmethod	alpha 0
	movea	5
	delay	400
	offset	1 590
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif
	frame	data/levels/3-1/3-1bb.gif

Code:
music		data/music/2-2.ogg
background	data/chars/misc/empty.gif
bglayer     data/levels/3-1/3-1p1.gif  0.7 0 0 0 -71 0 -1 -1 1 1 0 0 0 0 -0.9
bglayer     data/levels/3-1/3-1p2.gif  0.7 0 0 0 -41 0 -1 -1 1 1 0 0 0 0 -1.3
bglayer     data/levels/horsetrack1/horsetrackb3.gif  0.7 0 0 0 -41 0 -1 -1 1 0 0 0 0 0 -4.3
bglayer     data/levels/horsetrack1/horsetrackb2.gif  0.7 0 0 0 -41 0 -1 -1 1 0 0 0 0 0 -13.3
bglayer     data/levels/horsetrack1/horsetrackb.gif  0.7 0 0 0 -41 0 -1 -1 1 0 0 0 0 0 -33.3
bglayer     data/levels/horsetrack1/horsetrack1.gif  0.7 0 0 0 0 0 -1 -1 1 0 0 0 0 0 -50
fglayer     data/levels/horsetrack1/horsetracks2.gif  -45 0.7 0 0 0 0 0 -1 -1 1 2 0 0 0 0 -50
panel	    data/chars/misc/empty.gif
order           a
bgspeed 1 1 
settime         0
light           -256 90
at 0
spawn1          0 48 0
spawn2          0 68 0
#z 400 480
setweap 3

#-------------------lightcicle---------------lightcicle---------------lightcicle---------------lightcicle

Group	100 100
at	0

spawn	lightrain
@script
void main() {
   void self = getlocalvar("self");
   
   performattack(getlocalvar("self"), openborconstant("ANI_follow2"));
}
@end_script
flip 1
coords	0 485
at 0
 
hey ilu, sure i giv it a check, the entity is ok, displays behind panel, the reason it didnt before is because i maded panel transparent and used a bglayer in it´s place, the problem are the bglyers, any way to place/spawn a entity behind them?
 
Gurtag,

By default bglayers are behind the panel layer, which is in turn behind the default playfield where entities are drawn. You can adjust where an entity is drawn with the setlayer command, but bglayers are not adjustable and get drawn in order they appear in text. If you want fine control over where the layer is, use fglayer instead. They work exactly the same as bglayers, but include one more parameter that allows you to manually adjust their Z layer position.

HTH,
DC
 
Damon Caskey said:
Gurtag,

By default bglayers are behind the panel layer, which is in turn behind the default playfield where entities are drawn. You can adjust where an entity is drawn with the setlayer command, but bglayers are not adjustable and get drawn in order they appear in text. If you want fine control over where the layer is, use fglayer instead. They work exactly the same as bglayers, but include one more parameter that allows you to manually adjust their Z layer position.

HTH,
DC

Hello.  I need help with this situation:


The grey floor is a bglayer, and  the cyborg inside the capsule & other things around that are an entity type panel (because its a two frame animation)

I want to add this image with alpha transparency to simulate a green like window, but i cant put it as a bglayer in front of the entity (Stays in front of the floor but behind the entity)

https://i.imgur.com/zXKqmru.gif

can i resolve this problem using a fglayer?
 
yes fglayer should do the trik, dont forget that what it makes it special is his first parameter wich determines it´s Z/deep display position on screen, i would advice to make panel and background transparent and use fglayers instead, could avoid you future shenanigans when seting this type of levels.
 
O Ilusionista said:
pepodmc something I've found weird on that stage - the angle of the floor.
Compare the angle of the floor where you walk agains the floor on the back...

yeah i know, but i thought that it didnt looked too bad XD

But you are right, i will modify the grey floor so it has a perspective similar to the floor the character walks. Or use another floor sprite.

Gurtag said:
yes fglayer should do the trik, dont forget that what it makes it special is his first parameter wich determines it´s Z/deep display position on screen, i would advice to make panel and background transparent and use fglayers instead, could avoid you future shenanigans when seting this type of levels.

When you say " i would advice to make panel and background transparent " , you mean, totally transparent and do everything using fglayers?

Or my interpretation of what you said is too xtreme XD ?

 
When you say " i would advice to make panel and background transparent " , you mean, totally transparent and do everything using fglayers?

I think yes. Its what I did on some stages where I have animated background - the panel is a transparent image, while I have an entity with all animations behind it.

You just need to set the proper layer. I've added this to my panel typed entity
setlayer 20
 
O Ilusionista said:
When you say " i would advice to make panel and background transparent " , you mean, totally transparent and do everything using fglayers?

I think yes. Its what I did on some stages where I have animated background - the panel is a transparent image, while I have an entity with all animations behind it.


You just need to set the proper layer. I've added this to my panel typed entity
setlayer 20

I make it work. Thanks to both!

But it left me wondering if it wouldn't be better to remove bglayers from openbor entirely to encourage people to use fglayers in these kinds of situations.

Fglayer its like bglayer with steroids, you can do a lot of different things with it.
 
But it left me wondering if it wouldn't be better to remove bglayers from openbor entirely to encourage people to use fglayers in these kinds of situations.
I agree with you, but this would break the backward compatibility. And we avoid to make it as much as we can.
As the engine envolves, there are many other things we could remove because we have better options (like "remap"), but we can't do it as explained above.

Fglayer its like bglayer with steroids, you can do a lot of different things with it.
Indeed! Damon Caskey teach me how yo use it and now I can do a lot of cool stuff with it :)
 
Back
Top Bottom