Legacy GM Whitescreen, then switch to windowed mode

chaslinux

Member
My game starts in full screen mode. When the player runs out of lives it seems to switch from full screen to windowed mode. I also think there's some kind of error since I get a white screen for a second before it switches to windowed mode.

Death happens when they player collides with another object. I have a few objects that have collision events (with instance_destroy() self and other). After 3 lives are loss the obj_deadplayer object gets called. Obj_deadplayer just changes the angle.

The collision event for each object contains the following snippet of code:
Code:
    else // this is game over
    {
        instance_create(0,0,obj_gameover);
        // the next line is a bug because it doesn't check to see if player actually
        // got a high score ...
        global.name = get_string_async("Enter your name (10 characters max): ", "");

        // get_name = false;
    }
At the end of the object (that the player collides with) I have an asynchronous dialog with the following code:

Code:
// listen for async dialog even from obj_player (else) where player game over is triggered

var ident = ds_map_find_value(async_load, "id");

if ident == global.name
{
    if ds_map_find_value(async_load, "status") // if ok is click on dialog box
    {
        global.name = ds_map_find_value(async_load, "result"); //get player's name

        // trim the player's name to 10 characters
        if string_length(global.name) > 10
        {
            global.name = string_copy(global.name, 1, 10);
        }
                     
        // open scores.ini from fasteroids game directory
        ini_open("scores.ini")
        for (i = 0; i < 10; i++)
        {
            // populate the scores array with values from the ini file.
            global.score_array[i, 0] = ini_read_string(string(i), "Name", "Mr. Fast");
            global.score_array[i, 1] = ini_read_real(string(i), "Score", 0);
        }
        ini_close();
     
        // Look through the array to assign the player spot
        for (i = 0; i < 10; i++)
        {
            if (global.points > global.score_array[i, 1]) // score should be player score
            {
                // Start at the last element of the array, set each to one before it
                for (tscores = 9; tscores > i; tscores--)
                {
                    global.score_array[tscores, 0] = global.score_array[tscores-1, 0];
                    global.score_array[tscores, 1] = global.score_array[tscores-1, 1];
                }
                // now set the player score in its spot
                global.score_array[i, 0] = global.name;
                global.score_array[i, 1] = global.points;
                break;
            }
        }
        // Now update the score.ini file with updated info
       ini_open("scores.ini");
       for (i = 0; i < 10; i++)
        {
            ini_write_string(string(i), "Name", global.score_array[i, 0]);
            ini_write_real(string(i), "Score", global.score_array[i, 1]);
        }
        ini_close(); // close the file
     
        room_goto(rm_highscores);       
    }
}
I can't seem to find where it's switching from full screen to windowed mode, but I suspect this asynchronous dialog is what's causing the switch. There's nothing in rm_highscores Creation Code and it doesn't really even get that far since it asks for the player name first.

Cheers and thanks!
 
N

noobhere

Guest
@chaslinux Yes, same thing here. Mine was switching when show_message or show_question. I know because when I remove, it doesn't. But I also don't know how could it does the switch.
 

chaslinux

Member
You're right there. I've been there - AFAIK your options are to live with it, or create your own input dialogue.

Hope I helped :)
This is what I ended up doing, while my input dialog looks and feels pretty terrible, it works -- kind of. There's still a bug I have to squash where it asks for a name before testing to see if the global.points is even greater than the array of high scores - in other words it just goes to the rm_nameroom regardless of whether the player got a high score or not. But that problem is easy to fix, it's just moving a bit of code around and testing before redirecting to the rm_nameroom.

Thanks Fat_Man3468800, now I just need to do a bit of beautification!
 
Top