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
            }

    }
}
 
I came across a new, particularly odd issue.

Whenever I return the main menu and after the hall of fame screen, there's an odd chance of the menu BG animation flickering out and the title one completely taking over.
Here's what I have thus far:


Code:
void main()
{
    
if(openborvariant("in_titlescreen")){
        drawstring(110,10,3,"Version 2.10");
        drawstring(110,240,2,"Incomplete Build - TESTING ONLY");
        drawstring(110,250,2,"MysticalMist 2024-2026");
        void counter = getlocalvar("counter");
        void vSpawn;
        void counter2 = getlocalvar("counter2");
        counter2 = setlocalvar("counter2",0);

        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,-2); // set the position of the entity
            subent=spawn();  //  spawn the entity
            changeentityproperty(subent, "position", 1,0,-2); //for safe, set again the position
            counter = setlocalvar("counter",1); // turn on the variable, blocking a new spawn to be made
            }
}

if(openborvariant("in_system_options"))
{
drawstring( 140, 50,1,"Models:  Cached "+openborvariant("models_cached")+" - Loaded:  "+openborvariant("models_loaded"));
drawstring( 100, 60,1,"Entities:  Enemies - "+openborvariant("count_enemies")+" - NPCs:  "+openborvariant("count_npcs")+" - Total:  "+openborvariant("count_entities"));

    //White Dragon debug. Thanks!
    int i = 0, count = 0;
    int x = 10, y = 10, font_index = 0, yspace = 10;
    int prev_strwidth = 0, cols = 10;

    for(i = 0; i < openborvariant("count_entities"); i++) {
        void ent = getentity(i);
        char name = "", comma = ", ";
        int col = count/cols; // current colon

            if ( ent == NULL() || !getentityproperty(ent,"exists") ) continue;
            name = getentityproperty(ent,"model");
            if (i >= openborvariant("count_entities")-1) comma = "";
            drawstring(x+prev_strwidth,y+yspace*col,font_index,(name+comma));
            prev_strwidth += strwidth((name+comma),font_index); // sum row spaces
            ++count; // count ents
            if (col < count/cols) prev_strwidth = 0; // reset colons
        }
}

  if(openborvariant("in_level")){
    displayContinue();
    void counter = getlocalvar("counter");   
   counter = setlocalvar("counter",0);
void counter2 = getlocalvar("counter2");
    counter2 = setlocalvar("counter2",0);
//Announcer
processRushCount();
  }

if(openborvariant("in_menuscreen"))
    {   
          drawstring(110,10,3,"Version 2.10");
        drawstring(110,240,2,"Incomplete Build - TESTING ONLY");
        drawstring(110,250,2,"MysticalMist 2024-2026");
        void counter = getlocalvar("counter");
        counter = setlocalvar("counter",0);
        void vSpawn;
        void counter2 = getlocalvar("counter2");

        while(counter2!=1)
        {
            void subent;
            loadmodel("menufx"); // name of the entity to be loaded
            clearspawnentry(); // clean the spawn entry
            setspawnentry("name", "menufx"); // 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
            counter2 = setlocalvar("counter2",1); // turn on the variable, blocking a new spawn to be made
            }
    }



if(openborvariant("in_halloffamescreen"))
    {   
          drawstring(110,10,3,"Version 2.10");
        drawstring(110,240,2,"Incomplete Build - TESTING ONLY");
        drawstring(110,250,2,"MysticalMist 2024-2026");
        void counter2 = getlocalvar("counter2");
        void vSpawn;
        void counter = getlocalvar("counter");
        counter = setlocalvar("counter",0);
        while(counter2!=1)
        {
            void subent;
            loadmodel("menufx"); // name of the entity to be loaded
            clearspawnentry(); // clean the spawn entry
            setspawnentry("name", "menufx"); // define the entity to be spawn
            setspawnentry("coords", 1,0,-1); // set the position of the entity
            subent=spawn();  //  spawn the entity
            counter = setlocalvar("counter",0);
            changeentityproperty(subent, "position", 1,0,-1); //for safe, set again the position
            counter2 = setlocalvar("counter2",1); // turn on the variable, blocking a new spawn to be made
            }

    }
if(openborvariant("in_selectscreen")){
void counter = getlocalvar("counter");   
void counter2 = getlocalvar("counter2");
clearspawnentry(); // clean the spawn entry
    counter2 = setlocalvar("counter2",0);
}

if(openborvariant("in_showcomplete")){
void counter = getlocalvar("counter");   
void counter2 = getlocalvar("counter2"); 
clearspawnentry(); // clean the spawn entry
counter2 = setlocalvar("counter2",0);
counter = setlocalvar("counter",0);
}

if(openborvariant("in_gameoverscreen")){
void counter = getlocalvar("counter");   
void counter2 = getlocalvar("counter2"); 
clearspawnentry(); // clean the spawn entry
counter2 = setlocalvar("counter2",0);
counter = setlocalvar("counter",0);
}
}

I tried to address the counters in every screen possible, yet the title animation easily takes priority over the menu one.
 
Back
Top Bottom