Solved About the continue function

Question that is answered or resolved.

DD Tokki

Well-known member
bor - 0000.png

In Kunio LA, the continue appears in the middle of the screen like an arcade style. I want to know about this function.
 
hello, you can add this script in updated.c
Code:
void main()
{
  if(openborvariant("in_level")){
    displayContinue();
  }
}

void displayContinue()
{//Countdown time
    void P1 = getplayerproperty(0, "entity");
    void P2 = getplayerproperty(1, "entity");
    void sample = loadsample("data/sounds/timeover.wav");
    int time = openborvariant("elapsed_time");
    int layer = 1000000003;
   
    if (P1 == NULL() && P2 == NULL()){
        if (getglobalvar("cd") >= 1 || getglobalvar("cd2") >= 1){
        if (getplayerproperty(0, "joining") != 1 && getplayerproperty(1, "joining") != 1){
         drawbox(0,0,320,244,1000000001,rgbcolor(0,0,0),6);
         drawstring(117, 102, 3, "continue", layer);
                if (time >= getglobalvar("elapsed_time") + 0 && time <= getglobalvar("elapsed_time") + 439){
                    drawstring(156, 123, 3, "9", layer);
                }if (time >= getglobalvar("elapsed_time") + 440 && time <= getglobalvar("elapsed_time") + 879){
                    drawstring(156, 123, 3, "8", layer);
                }if (time >= getglobalvar("elapsed_time") + 880 && time <= getglobalvar("elapsed_time") + 1319){
                    drawstring(156, 123, 3, "7", layer);
                }if (time >= getglobalvar("elapsed_time") + 1320 && time <= getglobalvar("elapsed_time") + 1759){
                    drawstring(156, 123, 3, "6", layer);
                }if (time >= getglobalvar("elapsed_time") + 1760 && time <= getglobalvar("elapsed_time") + 2199){
                    drawstring(156, 123, 3, "5", layer);
                }if (time >= getglobalvar("elapsed_time") + 2200 && time <= getglobalvar("elapsed_time") + 2639){
                    drawstring(156, 123, 3, "4", layer);
                }if (time >= getglobalvar("elapsed_time") + 2640 && time <= getglobalvar("elapsed_time") + 3079){
                    drawstring(156, 123, 4, "3", layer);
                }if (time >= getglobalvar("elapsed_time") + 3080 && time <= getglobalvar("elapsed_time") + 3519){
                    drawstring(156, 123, 4, "2", layer);
                }if (time >= getglobalvar("elapsed_time") + 3520 && time <= getglobalvar("elapsed_time") + 3959){
                    drawstring(156, 123, 4, "1", layer);
                }if (time >= getglobalvar("elapsed_time") + 3960){
                    drawstring(156, 123, 4, "0", layer);
                }if (time >= getglobalvar("elapsed_time") + 4400){
                    jumptobranch("end", 1);
                    playsample(openborconstant(sample), 0, 120, 120, 100, 0);
                }
                 if(playerkeys(0, 1, "attack") || playerkeys(1, 1, "attack")){
                  setglobalvar("elapsed_time",getglobalvar("elapsed_time")-219);
              }
            }
        }
    }
}

Player text added ondrawscript data/scripts/ondraw/player.c


Code:
void main(){
    setglobalvar("elapsed_time", openborvariant("elapsed_time"));
    setglobalvar("cd", getplayerproperty(0, "credits"));
    setglobalvar("cd2", getplayerproperty(1, "credits"));
}
The countdown will be executed after the script sprite dies, and the countdown time can be accelerated by pressing the attack button.
 
About the text being at the center, this is used in either drawstring or settextobj. Look at "2+1" which is sticking with numbers and strwidth, under either those two and it's what makes the text become center, but you need a horizonal resolution variant (openborvariant("hresolution")) for screen's x coordinate.

@Kratus's continue text is centered in his SOR2X mod. Here's an example code of the it.
Code:
void drawClock()
{//Draw custom clock used for level timer
    float hRes        = openborvariant("hresolution");
    float time        = openborvariant("game_time");
    float channel    = 80;
    float maxTime    = 39600;
    float black        = rgbcolor(0x00,0x00,0x00);
    float red        = rgbcolor(0x80,0x00,0x00);
    float white        = rgbcolor(0xFF,0xFF,0xFF);
    int xSprite        = 226;
    int xBox        = 0;
    int yBox        = 269;
    int font0        = 3;
    int font1        = 7;
    int iconLayer    = 60000;
    int barLayer    = 50000;
    int backLayer    = 1000000001;
    int textLayer    = 1000000003;
    
    //APPLY DRAWMETHOD EFFECTS
    setdrawmethod(NULL(),1,256,256,0,0,0,6);
    changedrawmethod(NULL(), "channelr", channel); //CHANNEL DRAWMETHOD SETTINGS
    changedrawmethod(NULL(), "channelg", channel); //CHANNEL DRAWMETHOD SETTINGS
    changedrawmethod(NULL(), "channelb", channel); //CHANNEL DRAWMETHOD SETTINGS
    
    //GAME TIMER
    if(openborvariant("pause") == 0 && openborvariant("in_options") != 1){ //CHECK IF THE GAME IS NOT PAUSED OR IN OPTIONS
        if(getglobalvar("levelTime") == "timeline"){
            drawsprite(getglobalvar("timeIcon"), xSprite, 263, iconLayer); //TIME ICON
            drawbox(xBox, yBox, (maxTime*hRes)/(maxTime), 3, barLayer, black); //BLACK BORDER
            drawbox(xBox, yBox+1, (maxTime*hRes)/(maxTime), 1, barLayer+1, red); //RED FILL
            drawbox(xBox, yBox+1, (time*hRes)/(maxTime), 1, barLayer+2, white); //WHITE BAR
        }
        else
        if(getglobalvar("levelTime") == "numeric"){
            drawsprite(getglobalvar("timeIcon"), xSprite, 249, iconLayer); //TIME ICON
            drawstring((hRes-strwidth(""+time/400, font0))/2, 256, font0, time/400, barLayer); //CLOCK
        }
        else
        if(getglobalvar("levelTime") == "both"){
            drawsprite(getglobalvar("timeIcon"), xSprite, 246, iconLayer); //TIME ICON
            drawstring((hRes-strwidth(""+time/400, font0))/2, 253, font0, time/400, barLayer); //CLOCK
            drawbox(xBox, yBox, (maxTime*hRes)/(maxTime), 3, barLayer, black); //BLACK BORDER
            drawbox(xBox, yBox+1, (maxTime*hRes)/(maxTime), 1, barLayer+1, red); //RED FILL
            drawbox(xBox, yBox+1, (time*hRes)/(maxTime), 1, barLayer+2, white); //WHITE BAR
        }
    }
    
    //"CONTINUE" SCREEN TIMER
    if(getglobalvar("activeText") == "continue"){
        if(openborvariant("game_time") <= (maxTime/10) && openborvariant("game_time") > 0){
            setdrawmethod(NULL(),1,256,256,0,0,0,2);
            drawsprite(getglobalvar("back1"), 0, 0, backLayer);
            drawstring((hRes-strwidth("CONTINUE?", font1))/2+1, 120, font1, "CONTINUE?", textLayer);
            drawstring((hRes-strwidth(""+time/400, font1))/2+1, 138, font1, openborvariant("game_time")/400, textLayer);
        }else{
            setglobalvar("activeText", 0);
        }
    }
}

Kratus and pudu use drawstring, while I use settextobj for a reason. This is my example.

My Mod - 0801.png

Code:
int PLAY = openborvariant("count_players");

if(frame == 2 && PLAY == 2){
    void Lead = LeaderFind();
    //int LType = getentityproperty(Lead,"type");
    int P1 = getplayerproperty(0, "entity"); // Calling player 1
    int P2 = getplayerproperty(1, "entity"); // Calling player 2
    void P1name = getentityproperty(P1, "name");
    void P2name = getentityproperty(P2, "name");
    int hres = openborvariant("hresolution");
    int Font; // Identifying font index

    if(Lead == P1){
        Font = 1; // Using font2.png?
        //settextobj(index, x, y, font, layer, text, *time*); *optional*
        settextobj(0, (hres-strwidth(P1name+"_wins", 1))/2+1, 60, Font, 800, P1name+"_wins"); // Centering text of the player one's name
        if(win1 == NULL()){
            setglobalvar("win1", 1);
        }if(win1 == 1){
            setglobalvar("win1", 2);
        }
    }
    
    if(Lead == P2){
        Font = 0;
        settextobj(1, (hres-strwidth(P2name+"_wins", 0))/2+1, 60, Font, 800, P2name+"_wins");
        if(win2 == NULL()){
            setglobalvar("win2", 1);
        }if(win2 == 1){
            setglobalvar("win2", 2);
        }
    }

    if(Lead != P1 && Lead != P2){
        settextobj(2, (hres-strwidth("DOUBLE_K.O.", 3))/2+1, 60, 3, 800, "DOUBLE_K.O.");
    }
    
}
 
Back
Top Bottom