hum, why? And this means the whole image or the actual sprite (minus the transparent area)?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)?

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
#import "data/scripts/dc_layer_animation.c"
void main(){
dc_layer_animation(3,14,45); // Top crowd
}
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.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
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.This tutorial comes highly requested, sorry for taking so long to get around to it. Hope it helps you!
Enjoy!
DC
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
#=============================================================================================
#import "data/scripts/LevelScripts/LevelScripts.c"
void main()
{
Animate_LevelSprites(1, 15, 13, "bglayer");
Animate_LevelSprites(16, 30, 12, "bglayer");
}
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.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?
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.I guess I could use if-else for branch name or current level index in the zangief.c instead.
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.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).
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).
#### 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
#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
}
Note: To avoid any issues with special effects or repetition, ensure source image dimensions are multiples of 4.
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.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"); }
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.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.
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.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.
Yes, I did modify the original code so I can use either bglayer or fglayer.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.
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.Don't overcomplicate yourself with how many numbers of lines you'll have. Calculate what you have, and you'll be fine.
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?).I have no idea why you are using one particular script for many levels you want
This update replaces the original script and tutorial with an all-new layer animation system. The new DC Layer Cycle library enables full animation sequence control while keeping the script leaner, faster, and easier to use.
Core features include:
- Multiple independent layer animations per level.
- Fixed or random frame delays.
- Frame jumps and random jump ranges.
- Runtime mutation of native layer properties.
- Automatic cleanup when the level ends.
- Lightweight playback by...