Animated screens - the easy way.

Here it goes...
Scripts.txt
Code:
alwaysupdate 1

Models.txt
Code:
load    bgfx        data/Sprites/bgfx/bgfx.txt

bgfx.txt
Code:
name    bgfx
health    10
type    panel
shadow  0
setlayer -2000
facing  1
nomove    1 1
palettte data/sprites/bgfx/bgfx_0.png


anim    idle
    loop    0
    offset    1 0
    delay    6
    @cmd    changeentityproperty getlocalvar("self") "direction" 1
    sound    data/sounds/go.wav
    frame    data/sprites/bgfx/bgfx_0.png
    @cmd    changeentityproperty getlocalvar("self") "setlayer" -2000
    frame    data/sprites/bgfx/bgfx_1.png
    frame    data/sprites/bgfx/bgfx_2.png
    frame    data/sprites/bgfx/bgfx_3.png
    frame    data/sprites/bgfx/bgfx_4.png
    frame    data/sprites/bgfx/bgfx_5.png
    frame    data/sprites/bgfx/bgfx_6.png
    frame    data/sprites/bgfx/bgfx_7.png
    frame    data/sprites/bgfx/bgfx_0.png

Should I attach the sprites for the bgfx too?
 
What's your input of it in updated.c like?

I have mine and it works.

C:
void main(){
    aniScreen();
}

void aniScreen(){
    if(openborvariant("in_titlescreen")){
        void counter = getlocalvar("counter");
        counter = setlocalvar("counter", 0);
    }
    if(openborvariant("in_selectscreen")){
        void counter = getlocalvar("counter");
        void vSpawn;
        while(counter!=1){
            void subent;
            loadmodel("scrSel");
            clearspawnentry();
            setspawnentry("name", "scrSel");

            void mStyle = getglobalvar("musicStyle");
            setspawnentry("coords", 1,0,-1); // set the position of the entity
            subent=spawn();  //  spawn the entity
            changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
            counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
            if(mStyle == 0){
                changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW1"));
                drawstring(20,30,0,"Testing",11100000);
            }else if(mStyle == 1){
                changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW3"));
                drawstring(20,30,0,"Go",11100000);
            }else if(mStyle == 2){
                changeentityproperty(subent, "animation", openborconstant("ANI_FOLLOW2"));
                drawstring(20,30,0,"check",11100000);
            }
        }
    }
}

Code:
name scrSel
type none
facing 1
palette none
nomove 1 1
setlayer -100000

animationscript data/scripts/animation/default.c

load selection
load bgmgrid
load selectr
load selectg
load selectb
load bgGreen
load bgRed
load bgBlue

anim spawn
    offset 480 0
    delay 2
    @cmd projectile 1 "selection" 0 0 0
    frame data/chars/misc/empty.gif
    frame data/chars/misc/empty.gif

anim follow1 #Green
    delay 2
    offset 0 0
    @cmd spawn001 "bgmgrid" "bgmgrid" 0 3 0 1
    @cmd spawn001 "bgGreen" "bgGreen" 0 0 0 1
    spawnframe 0 30 -40 0 0
    custentity selectg
    @cmd changeentityproperty getlocalvar("self") "direction" 1
    frame data/bgs/select/selectg.png
    frame data/bgs/select/selectg.png

anim follow2 #Blue

    delay 2
    offset 0 0
    spawnframe 0 0 0 0 0
    custentity selectb
    @cmd spawn001 "bgmgrid" "bgmgrid" 2 3 0 1
    @cmd spawn001 "bgBlue" "bgBlue" 0 0 0 1
    @cmd changeentityproperty getlocalvar("self") "direction" 1
    @cmd spawn01 "bgBlue" 0 0 0
    frame data/bgs/select/selectb.png
    frame data/bgs/select/selectb.png

anim follow3 #Red

    delay 2
    #offset 480 0
    offset 0 0
    @cmd spawn001 "bgRed" "bgRed" 0 0 0 1
    spawnframe 0 30 0 0 0
    subentity selectr
    @cmd spawn001 "bgmgrid" "bgmgrid" 1 3 0 1
    @cmd changeentityproperty getlocalvar("self") "direction" 1
    frame data/bgs/select/selectr_.png
    frame data/bgs/select/selectr_.png

Let me put some of the spawning samples, even though I mainly do is for the music on my part. You really don't have to copy mine though. Get the logic of coding for reference.

Code:
name selection
type none
setlayer -1000
nomove 1 1


anim idle

    offset 0 0
    delay 5
    loop 1
    @cmd changeentityproperty getlocalvar("self") "direction" 1
    frame data/bgs/select/selection.png
    frame data/bgs/select/selection.png

Code:
name bgmgrid
type none
facing 1
nomove 1 1
setlayer -10000
palette data/bgs/select/bg-grid.gif
alternatepal data/bgs/select/red.gif
alternatepal data/bgs/select/blue.gif

anim idle
    offset 480 0
    delay 4
    @cmd changeentityproperty getlocalvar("self") "direction" 1
    frame data/bgs/select/bg-grid.gif
    frame data/bgs/select/bg-grid.gif

Code:
name selectG
type none
facing 1
setlayer -30000

anim idle

    delay 4
    offset 0 0
    loop 1
    frame data/bgs/select/selectG_index2.png
    frame data/bgs/select/selectG_index2.png

Code:
name bgGreen
type none
facing 1
nomove 1 1
#setlayer -100000

anim idle
    offset 0 0
    delay 4
    frame data/bgs/select/selectG.png

ROD_MAXED_OUT! - 0000.png
ROD MAXED OUT! - 0245.png
ROD MAXED OUT! - 0079.png
 
Incoming code!
C:
void main(){

if(openborvariant("in_titlescreen"))
    {    
        void counter = getlocalvar("counter"); 
        counter = setlocalvar("counter",0);
    }
    
if(openborvariant("in_selectscreen"))
    {    
  
        void counter = getlocalvar("counter"); 
        void vSpawn;
        while(counter!=1)
        {
            void subent;
            loadmodel("bgfx"); // name of the entity to be loaded
            clearspawnentry(); // clean the spawn entry
            setspawnentry("name", "bgfx"); // define the entity to be spawn
            setspawnentry("coords", 1,0,-1); // set the position of the entity
            subent=spawn();  //  spawn the entity
            changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
            counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
            }

    }
}
 
Back
Top Bottom