gameover.txt / Player Quit script

Bruce

Active member
Hello everyone,

Does this gameover.txt only play gif animation and music, nothing else?

I had clearglobalvar(); in the gameover.txt but it is not working.
I am trying to find a way to clear all global variables when the player quits or all players lose their lives.

Thank you
 
Solution
That makes a lot of senses. Can you also give me an example of this as well?
Sorry, I forgot to say that you need to put the code I posted inside the updated.c file in order to make it to work. You can detect the title screen like the example below:

C:
void main()
{
    //TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        clearglobalvar();
    }
}
Does this gameover.txt only play gif animation and music, nothing else?
@Bruce According to the manual, yes (plus the video command to play webm too).

1703891832901.png

You can detect the game over event and do all the tasks you need, like the code below. Personally I prefer to clear variables at the title screen because in my case I need them to be available at the hiscore event, I don't know if it's your case.
In addition, I posted two ways to detect the gameover event in the code below.

C:
void main()
{
    //GAME OVER TXT SCENE
    if(openborvariant("current_scene") == "data/scenes/gameover.txt"){
        clearglobalvar();
    }

    //GAME OVER SCREEN
    if(openborvariant("in_gameoverscreen")){
        clearglobalvar();
    }
}
 
Personally I prefer to clear variables at the title screen because in my case I need them to be available at the hiscore event
That makes a lot of senses. Can you also give me an example of this as well?
Thank you so much

update:

I just tried the the code below in gameover.txt but it is not working. What is going on?

Code:
music           data/music/gameover.ogg
animation        data/scenes/gameover.gif 0 0

//GAME OVER SCREEN
if(openborvariant("in_gameoverscreen")){
   clearglobalvar();
}

//GAME OVER TXT SCENE
if(openborvariant("current_scene") == "data/scenes/gameover.txt"){
   clearglobalvar();
}
 
Last edited:
That makes a lot of senses. Can you also give me an example of this as well?
Sorry, I forgot to say that you need to put the code I posted inside the updated.c file in order to make it to work. You can detect the title screen like the example below:

C:
void main()
{
    //TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        clearglobalvar();
    }
}
 
Solution
Sorry, I forgot to say that you need to put the code I posted inside the updated.c file in order to make it to work. You can detect the title screen like the example below:

C:
void main()
{
    //TITLE SCREEN
    if(openborvariant("in_titlescreen")){
        clearglobalvar();
    }
}
Ahh I see.

Thank you
 
updated.c file
you can please explain about the

Code:
update.c
Engine starts update cycle.

updated.c
Engine completes update cycle.

How often does it run, etc..?
I saw the optimizing scripts topic that DCurrent posted mentioning about putting stuff into the update.c vs the timetick.

I see the existing game FF LNS which had so much stuff in the update.c
I started adding stuff to it too. It was working of what I wanted to do, but I had no clue how it is supposed to work.

Now I am trying to create my own game, so I need to learn from scratch.
After you answered my questions, I started understanding it better.

Thank you so much for your help.
 
you can please explain about the

Code:
update.c
Engine starts update cycle.

updated.c
Engine completes update cycle.
By default I always use the updated.c, I only use update.c to capture/interrupt events before they in fact happens. As an example, I use the update.c to disable certain keys before the engine detect the input and then I can apply other effects to it.
 
Back
Top Bottom