Animated Background Layers

Animated Background Layers

🤦‍♂️ I forgot about it. I was just curious if there's a layer property for mirroring that can be for use in the engine. I guess it's not documented. Thanks, DC. :)
 
Updated with some minor formatting changes, and removed the point about scrolling accuracy. Background entities can scroll with pinpoint accuracy. You just have to make sure the sprite dimensions are mutiples of 4 - same as the the native stage layers.
 
Updated with some minor formatting changes, and removed the point about scrolling accuracy. Background entities can scroll with pinpoint accuracy. You just have to make sure the sprite dimensions are mutiples of 4 - same as the the native stage layers.
hum, why? And this means the whole image or the actual sprite (minus the transparent area)?
 
hum, why?

It's in the manual about layers. The manual says multiples of 4 are required, but that's not strictly true. You can use any size you feel like. However, if the image width (or height for vertical scrolling) is not a multiple of 4, you may get a single pixel inaccuracy in scrolling. This isn't unique to OpenBOR. Every console ever made had similar requirements, and so do many other scrolling engines. It has to do with the game world being floating point while the image dimensions and screen are whole numbers.

I noticed that panel entities had an intermittent pixel inaccuracy compared to layers, and thought it was due to formula differences. Then I took another look and found that shouldn't be the case. So just for fun I made sure my model sprite dimensions were multiples of 4 and sure enough, it fixed all the inaccuracies.

And this means the whole image or the actual sprite (minus the transparent area)?

The whole image, transparent area included. The engine uses the original (untrimmed) dimensions while calculating offsets. That means you can just add a bit blank area to get the multiple of 4.

Example: In this level all the loose cloth blows about and the overhead lamp swings back and forth. To do that I used panel entities. See the example sprites for swinging lamp. If perfectly trimmed to animated area, the width would not be a multiple of 4, so there's a couple of extra pixels. You could do the same by adding some transparent pixels if you wanted. During the game play, the scrolling is 100% perfect.

panel_0.png

idle_0.pngidle_1.pngidle_2.pngidle_3.pngidle_4.pngidle_5.pngidle_6.png
 
Do I place these codes in the level.txt?

int first_index = 5;
int last_index = 8;
int delay = 20;

dc_layer_animation(first_index, last_index, delay);


Thank you very much
 
It's not that. You can simply put it like this here with updatescript in a level txt.

Example:

VSZangief.txt (from levels folder):
Code:
fglayer data/sprites/hud_base.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0     # 0
fglayer data/sprites/hud.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0        # 1
###########################################

fglayer data/bgs/zangief/zangief.pcx00010000.png -63 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 # 2

bglayer data/bgs/zangief/zangief.pcx00000000.png 0.365 0 0 0 1 1 1 1 1 0 0 0 0 0 0 # BG layer not counted as animated background layer

################ ANIMATED TOP CROWD ################
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 3
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 4
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 5
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 6
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 7
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 8
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 9
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 10
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 11
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 12
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 13
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 14
####################################################

panel        data/bgs/zangief/panel.gif
direction    both
notime        1
settime        0
order        a
updatescript    data/bgs/zangief/zangief.c
music    data/music/zangief.ogg 2647014.3

zangief.c (from that certain folder path):

Code:
#import "data/scripts/dc_layer_animation.c"

void main(){
    dc_layer_animation(3,14,45); // Top crowd
}

It can be anywhere you wanna put. It doesn't have to be in the BGS folder, but that's up to you. The last parameter is the timing of the animated layers.

@DCurrent How can I stop or pause the animated background or foreground layers from playing as animation when a text type entity exists like dialogue and such?
 
Can't believe I only just discovered this. Excellent tutorial! In Project FGC, I did the asinine workaround of spawning a non moving entity at coord 0 0 to achieve animated stage effects. This is  so much easier.
 
Code:
Code:
fglayer data/sprites/hud_base.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0     # 0
fglayer data/sprites/hud.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0        # 1
###########################################

fglayer data/bgs/zangief/zangief.pcx00010000.png -63 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 # 2

bglayer data/bgs/zangief/zangief.pcx00000000.png 0.365 0 0 0 1 1 1 1 1 0 0 0 0 0 0 # BG layer not counted as animated background layer

################ ANIMATED TOP CROWD ################
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 3
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 4
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 5
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 6
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 7
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 8
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 9
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 10
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 11
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 12
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 13
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 14
####################################################

panel        data/bgs/zangief/panel.gif
direction    both
notime        1
settime        0
order        a
updatescript    data/bgs/zangief/zangief.c
music    data/music/zangief.ogg 2647014.3
Thank you so much for the instructions on how to set it up for updatescript. I didn't have a chance to work on this until now.
Now I am working on it, and it is working fine. However, I realized I can not use this zangief.c for another level unless this level has the same number of sprites and using the same delay.
Does this mean I have to create another ones of zangief.c and modify them to work for other levels?

Thank you so much.

Edited: I guess I could use if-else for branch name or current level index in the zangief.c instead.
 
Last edited:
This tutorial comes highly requested, sorry for taking so long to get around to it. Hope it helps you!

Enjoy!
DC
You mentioned that you have both the lamp and the waterfall cycling at the same time, but I have no clue how you did it.
For my situation, I want to animate the same set of sprites 2 times (for the left and the right of the screen).
Sorry I am still learning how the OpenBor engine works....
Can you or anyone else please give me an advice if it is ok for me to do something like this or it is better to spawn an entity 2 times instead?

level.txt
Code:
music        data/music/NinjaGaiden_4_2.ogg
bglayer     data/bgs/Factory/Building_bg.png     1 0 0 -30 0 0 1 1   0 0    0 0 0 0 0 

#=============== SPRITES ANIMATION with updatescript ==========================================
# ==== ANIMATE SPRITES from index 1 - 15 =======
bglayer     data/bgs/Factory/FX/FactoryFX01.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX03.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX05.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX07.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX09.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX11.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX13.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX15.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX17.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX19.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX21.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX23.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX25.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX27.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX30.png   0.9  0.9  -200  -1000   0  0  1  1    1  1

# ==== ANIMATE SPRITES from index 16 - 30 =====
bglayer     data/bgs/Factory/FX/FactoryFX01.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX03.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX05.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX07.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX09.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX11.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX13.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX15.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX17.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX19.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX21.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX23.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX25.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX27.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX30.png   0.9  0.9  700  -1000   0  0  1  1    1  1

updatescript     data/scripts/LevelScripts/AnimateSprites.c
#=============================================================================================


Code:
#import "data/scripts/LevelScripts/LevelScripts.c"

void main()
{
        Animate_LevelSprites(1, 15, 13, "bglayer");  
        Animate_LevelSprites(16, 30, 12, "bglayer");  
}

These sprites are just simply light weight fire sparks about 5-10kb each

Thank you so much for all your hard work!
 
Now I am working on it, and it is working fine. However, I realized I can not use this zangief.c for another level unless this level has the same number of sprites and using the same delay.
Does this mean I have to create another ones of zangief.c and modify them to work for other levels?
Of course. You have to create one updatescript file per level. I think you can use branch with the if-else condition ONLY if you use branch, though I've never done it like that before. I already did one for Zangief's stage and another one for another level. I have no idea why you are using one particular script for many levels you want.

I guess I could use if-else for branch name or current level index in the zangief.c instead.
I guess you figured out. I think using current level index is okay, but you have to label the notes what level you are using because from what I saw and had done, the custom select screen level is counted as a level (if skipselect is used). It would be better to use branch for this.

You mentioned that you have both the lamp and the waterfall cycling at the same time, but I have no clue how you did it.
For my situation, I want to animate the same set of sprites 2 times (for the left and the right of the screen).
You can do that easily but let me ask you this. Is each of your sprites separately cropped/trimmed? I recommend you make images with equal size dimensions, multiples of 4, as noted in the tutorial.

This can be background, bglayer, or fglayer, for general use.
bglayer {path} {xratio} {zratio} {xposition} {zposition} {xspacing} {zspacing} {xrepeat} {zrepeat} {transparency} {alpha} {watermode} {amplitude} {wavelength} {wavespeed} {bgspeedratio} {quake} {neon}

background {path} {xratio} {zratio} {xposition} {zposition} {xspacing} {zspacing} {xrepeat} {zrepeat} {transparency} {alpha} {quake} {neon}


  • These 2 command have same effect which is create a background layer with the image at {path}.
  • The image used must have a width which is a multiple of 4 (ex. 4, 200, 128, not 3, 202, 130).

Code:
#### PLEASE USE BOTH THESE IMAGES AS HUD FOR YOUR PLAYER(S) UNLESS IT'S BONUS STAGE #######
fglayer data/sprites/hud_base.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0     # 0
fglayer data/sprites/hud.png -1 1 0 3 3 1 1 1 1 1 0 0 0 0 0 0        # 1
###########################################

fglayer data/bgs/zangief/zangief.pcx00010000.png -63 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 # 2

bglayer data/bgs/zangief/zangief.pcx00000000.png 0.365 0 0 0 1 1 1 1 1 0 0 0 0 0 0 # BG layer not counted as animated background layer

################ ANIMATED TOP CROWD ################
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 3
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 4
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 5
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 6
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 7
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 8
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 9
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 10
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 11
fglayer data/bgs/zangief/zangief.pcx00020000.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 12
fglayer data/bgs/zangief/zangief.pcx00020001.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 13
fglayer data/bgs/zangief/zangief.pcx00020002.png -63 0 0 64 14 1 1 1 1 1 0 0 0 0 0 0 # 14
####################################################

############## ANIMATED BOTTOM CROWD ###############
fglayer data/bgs/zangief/zangief.pcx00030000.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 15
fglayer data/bgs/zangief/zangief.pcx00030001.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 16
fglayer data/bgs/zangief/zangief.pcx00030002.png -63 0 0 50 82 1 1 1 1 1 0 0 0 0 0 0 # 17
fglayer data/bgs/zangief/zangief.pcx00030000.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 18
fglayer data/bgs/zangief/zangief.pcx00030001.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 19
fglayer data/bgs/zangief/zangief.pcx00030002.png -63 0 0 50 82 1 1 1 1 1 0 0 0 0 0 0 # 20
fglayer data/bgs/zangief/zangief.pcx00030000.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 21
fglayer data/bgs/zangief/zangief.pcx00030001.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 22
fglayer data/bgs/zangief/zangief.pcx00030002.png -63 0 0 50 82 1 1 1 1 1 0 0 0 0 0 0 # 23
fglayer data/bgs/zangief/zangief.pcx00030000.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 24
fglayer data/bgs/zangief/zangief.pcx00030001.png -63 0 0 51 82 1 1 1 1 1 0 0 0 0 0 0 # 25
fglayer data/bgs/zangief/zangief.pcx00030002.png -63 0 0 50 82 1 1 1 1 1 0 0 0 0 0 0 # 26
#######################################################


bglayer data/bgs/zangief/zangief.pcx00040000.png 0.2441 0 -213 181 1 1 1 1 1 0 3 0.9 1 0 0
fglayer data/bgs/zangief/zangief.pcx00050000.png -63 0 0 330 151 1 1 1 1 1 0 0 0 0 0 0 # 27 - Hydrant


panel        data/bgs/zangief/panel.gif
direction    both
notime        1
settime        0
order        a
type 1
updatescript    data/bgs/zangief/zangief.c

C:
#import "data/scripts/dc_layer_animation.c"

void main(){
    dc_layer_animation(3,14,45); // Top crowd
    dc_layer_animation(15,26,38); // Bottom crowd
}

Do you know what this mean?
Note: To avoid any issues with special effects or repetition, ensure source image dimensions are multiples of 4.

The reason I put 12 lines in my Zangief level is that the sprites only have 3. What you have is 2 so you can put 4 lines. Use a multiplication of 4 to get that working. Don't overcomplicate yourself with how many numbers of lines you'll have. Calculate what you have, and you'll be fine.

level.txt
Code:
music        data/music/NinjaGaiden_4_2.ogg
bglayer     data/bgs/Factory/Building_bg.png     1 0 0 -30 0 0 1 1   0 0    0 0 0 0 0

#=============== SPRITES ANIMATION with updatescript ==========================================
# ==== ANIMATE SPRITES from index 1 - 15 =======
bglayer     data/bgs/Factory/FX/FactoryFX01.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX03.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX05.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX07.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX09.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX11.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX13.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX15.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX17.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX19.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX21.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX23.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX25.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX27.png   0.9  0.9  -200  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX30.png   0.9  0.9  -200  -1000   0  0  1  1    1  1

# ==== ANIMATE SPRITES from index 16 - 30 =====
bglayer     data/bgs/Factory/FX/FactoryFX01.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX03.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX05.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX07.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX09.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX11.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX13.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX15.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX17.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX19.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX21.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX23.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX25.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX27.png   0.9  0.9  700  -1000   0  0  1  1    1  1
bglayer     data/bgs/Factory/FX/FactoryFX30.png   0.9  0.9  700  -1000   0  0  1  1    1  1

updatescript     data/scripts/LevelScripts/AnimateSprites.c
#=============================================================================================


Code:
#import "data/scripts/LevelScripts/LevelScripts.c"

void main()
{
        Animate_LevelSprites(1, 15, 13, "bglayer");
        Animate_LevelSprites(16, 30, 12, "bglayer");
}
Why are you using bglayer instead of fglayer? Did you modify the source for the animated background layer by changing from fglayer to bglayer? (I don't understand why you are using it, but it got me wondering.) There's a reason to use fglayer instead of bglayer. bglayer always acts as the most behind layer in levels, but fglayer is all about changing Z number as if it were to be in Z. Are you quite confused with using the Z part? The first parameter of fglayer is Z, which you can change it to cover or become behind anything, but at the same time, the layer stays without moving in Z axis. It's not a Z axis at all, though. zposition is Z axis as part of fglayer and bglayer.

From looking at your code now, do you know what you are doing? What are you trying to do?

Unless I'm wrong, @DCurrent or anyone who has better knowledge of this can correct me on this.
 
You can do that easily but let me ask you this. Is each of your sprites separately cropped/trimmed? I recommend you make images with equal size dimensions, multiples of 4, as noted in the tutorial.
they are not trimmed. My situation is not critical, so it does not matter for me because it is just the fire sparks in the background.
The reason I put 12 lines in my Zangief level is that the sprites only have 3. What you have is 2 so you can put 4 lines. Use a multiplication of 4 to get that working. Don't overcomplicate yourself with how many numbers of lines you'll have. Calculate what you have, and you'll be fine.
I know what it means by "image dimensions are multiples of 4" , but I have not clue what you meant by my sprites only have 2. I have the total of 15 sprites.
Can you please help me understand this?
Why are you using bglayer instead of fglayer? Did you modify the source for the animated background layer by changing from fglayer to bglayer? (I don't understand why you are using it, but it got me wondering.) There's a reason to use fglayer instead of bglayer. bglayer always acts as the most behind layer in levels, but fglayer is all about changing Z number as if it were to be in Z. Are you quite confused with using the Z part? The first parameter of fglayer is Z, which you can change it to cover or become behind anything, but at the same time, the layer stays without moving in Z axis. It's not a Z axis at all, though. zposition is Z axis as part of fglayer and bglayer.
Yes, I did modify the original code so I can use either bglayer or fglayer.
I know the difference between the bglayer and fglayer, and I also know about the z values (go to the back with - value and front with + value).
I am using the bglayer because I only need these sprites right in front of the very back layer of background. Of course I could use fglayer and modify it from there.

Don't overcomplicate yourself with how many numbers of lines you'll have. Calculate what you have, and you'll be fine.
What I had was working fine. I wasn't sure if repeating cycling the sprites multiple times in the level.txt would cause any memory problems vs spawning multiple the entity multiple times.

I have no idea why you are using one particular script for many levels you want
It is because I still have no clue how the engine works as far as memory concerns. I am not sure if I should create 1 updatescript for all the levels or 1 updatescript per level (which way is better?).
Yes, I read somewhere about other scripts such as animationscript that it is better to split into small scripts. However, I am unsure if this theory also applies to updatescript and levelscript as well or not. If someone can help me answer this, would be greatly appreciated.

Thank you so much for your help.
 
Back
Top Bottom