fglayer help ( visual example inside)

PS_VITA

Active member
Hi guys -

As you can see from the illustration attached - I was wondering how can
I make the buildings in the middle of the stage begin to parallax (using fglayer)  to create the illusion that
the train begins to move when the player reaches the 750 pixels mark and then the "train stops"  around the players reaching the 1000 pixel mark (meaning how do I stop the fglayer parallax at that point in the stage?).
index.php


thanks
 

Attachments

  • copy.png
    copy.png
    25.5 KB · Views: 52
Use the buildings as a background and then change the bgspeed when you reach the scroll of 750.

Use this piece of code in any entity you can spawn at pos 750

spawn "YOUR_ENTITY_HERE"
@script void main() {
changelevelproperty("bgspeed", 10);
} @end_script

coords 0 0
at 750

The important parts are in red. Change the amount to fit your needs.
 
O Ilusionista said:
Use the buildings as a background and then change the bgspeed when you reach the scroll of 750.

Use this piece of code in any entity you can spawn at pos 750

spawn "YOUR_ENTITY_HERE"
@script void main() {
changelevelproperty("bgspeed", 10);
} @end_script

coords 0 0
at 750

The important parts are in red. Change the amount to fit your needs.

Hi O Ilusionista
first of all thank you. Second, when I first joined I saw a post where Damon Caskey
mentions that bgspeed is outdated and that fglayer can do what bglayer can do.

So that's why I mentioned it in the title.
 
I think you misunderstood what Damon said. Bgspeed is not outdated, at least from what I can remember.
Fglayer is a beast, but a simply background on this case will do the job for you.

If you don't need any extra control, just a simply background sprite, you can use BACKGROUND for sure.
 
My background is called cityback

I wont be able to test this because of the holidays but is the script written in this way?

spawn "cityback"
@script void main() {
changelevelproperty("bgspeed", 10);
} @end_script
coords  0 0
at  750


Or do I need to create a .txt file and name it cityback , so sorry I need a little more context.
 
No, you can declare that at spawns in level text directly.

And the script is independent to spawned entity, you can declare it on any spawns.

So if you have enemy spawned at 750, you can declare the script there, like this:
Code:
spawn Enemy
@script
 void main() {
  changelevelproperty("bgspeed", 10);
}
 @end_script
health  100
coords   600 200
at   750

And to add Ilu's answer, to stop the autoscrolling effect, declare this script at 1000:
Code:
spawn Enemy
@script
 void main() {
  changelevelproperty("bgspeed", 0);
}
 @end_script
health  100
coords   600 200
at   1000

PS VITA said:
when I first joined I saw a post where Damon Caskey
mentions that bgspeed is outdated and that fglayer can do what bglayer can do.

I believe Damon meant bglayer not bgspeed.
 
Bloodbane said:
No, you can declare that at spawns in level text directly.

And the script is independent to spawned entity, you can declare it on any spawns.

So if you have enemy spawned at 750, you can declare the script there, like this:
Code:
spawn Enemy
@script
 void main() {
  changelevelproperty("bgspeed", 10);
}
 @end_script
health  100
coords   600 200
at   750

And to add Ilu's answer, to stop the autoscrolling effect, declare this script at 1000:
Code:
spawn Enemy
@script
 void main() {
  changelevelproperty("bgspeed", 0);
}
 @end_script
health  100
coords   600 200
at   1000

PS VITA said:
when I first joined I saw a post where Damon Caskey
mentions that bgspeed is outdated and that fglayer can do what bglayer can do.

I believe Damon meant bglayer not bgspeed.

What if I have two background layers
how can I modify the script to know the difference between background #1 or #2?
 
PS VITA said:
Bloodbane said:
.......

What if I have two background layers
how can I modify the script to know the difference between background #1 or #2?

This topic is very helpful, in fact it seems that this should be able to fix/restore level 3 in NIghtslashers, where the carriage portion starts.
if multiple BG layer speed is possioble with a variation of this script, can lines within be included to trigger a character's running model?
 
PS VITA said:
What if I have two background layers
how can I modify the script to know the difference between background #1 or #2?

Script only modifies bgspeed. It doesn't affect bglayer directly. The reason a bglayer is affected by bgspeed is if its last parameter is not 0.
Code:
bglayer         {path} {xratio} {zratio} {xposition} {zposition} {xspacing} {zspacing} {xrepeat} {zrepeat} {transparency} {alpha} {watermode} {amplitude} {wavelength} {wavespeed} {bgspeedratio}

[quote author=oldyz]if multiple BG layer speed is possioble with a variation of this script, can lines within be included to trigger a character's running model?
[/quote]

Well, multiple bglayer speed is possible simply because of parameter I mentioned above.
For forcing running mode, you'd need different kind of script, which forces all players to enter running mode or to be specific change into weapon model for running mode.
However for stability, if player dies before running mode ends, you could either use:
1. Script in player's SPAWN animation which reenforce running mode and global variable which activates the mode.
OR
2. Entity which actively monitors all players and force any of them into running mode if he/she isn't in that mode yet.
 
changelevelproperty("bgspeed", 10); works only if you have your background on repeat -1 (forever)
how can I use this script to make the background repeat forever only at that certain point in the map?
because I don't want to have to repeat that part of the background as soon as the level is loaded - I only want
the background to start repeating at that certain point in the map I mentioned in the OP.

Thank you Bloodbane and O Ilusionista

Edit:

So - This just closes openbor

Code:
spawn gary
@script
 void main() {
  changelevelproperty("background", 0,          0,         2818,         100,         0,           0,          -1,        1,          1,              1);
}
 @end_script
health  100
coords   3000 204 1
at   -50
 
PS VITA Let me try to reply in parts:

What if I have two background layers
how can I modify the script to know the difference between background #1 or #2?
If I am not wrong, you can't have two "backgrounds, only one ( I can't check the source right now). You can, whoever, have multiples fglayers
Don't let the term FG fool you - fglayers can be placed in any layer you want to.  One example is this stage I made - excluding the background and the panel, everything is a fglayer - and one of those are placed behind the panel


As Bloodbane explained, you need to change the last value of fglayer to allow it to move with the stage.

works only if you have your background on repeat -1 (forever)
how can I use this script to make the background repeat forever only at that certain point in the map?

Take a look at this stage, at 3:49

The stage has a background which repeats itself and a fglayer cover the background (on the first part, where you can see a robot hand) which doesn't repeats itself. Also, I have a fglayer with the water mode set (not available on this video) which I don't want to repeat itself, because I have an area with a large pit and I don't want the water covering it.

Now skip to 7:20 and you will see that only the background is moving, and nothing else. I just had changed the bgspeed with that code.

This is my code:
Code:
background   data/bgs/sentinel-base1/sentxmen-bg.gif
panel      data/bgs/sentinel-base1/sentxmen-panel.gif
frontpanel   data/bgs/sentinel-base1/a3.gif

# fglayer   filepath                  Zpos    xratio   zratio   xoffset   zoffset   xspace   zspace   xrepeat   zrepeat   trans   alpha   w-mode   amp   wl   ws   move   quake   neon
fglayer      data/bgs/sentinel-base1/sentxmen-water.gif       -200   0.5   0.9   0.5   0   0   0   1   1   1   0   1   2.5   1.5   2       0       1       0
fglayer      data/bgs/sentinel-base1/sent_xmen_front2.gif       301   -1.3   0.9   0.5   0   0   0   -1   1   1   0   0   1.5   1   0       0       1       0

This just closes openbor
For sure it does. You are trying to change a levelproperty which isn't accepted - background.
Read the manual about which levelproperties you can change.

 
Just confirming what O Ilusionista mentioned about Background. There is only one "Background" in a stage, ever. That's because it also serves as the stage's base palette holder. Note the additional layers don't have to use this palette - they can all have their own. Layers also support 24bit png - but don't use 24bit unless you honest to goodness need it and know what you are doing. 256 colors per layer with unlimited layers is a lot. Like, a whole lot. Because of texture budgets, many developers don't even have that much in the current gen, and it's far more than any 4th gen developer could ever dream of.

DC
 
Back
Top Bottom