Trouble with fullscreen toggling

I

IJsandwich

Guest
I set up an extremely simple fullscreen toggle using the escape key, essentially the same code used in the manual example for window_set_fullscreen. When I press escape, the window switches between fullscreen and not fullscreen. However, when I toggle fullscreen, my player character, who works totally fine otherwise, gets locked into their walking animation when I move them. Pressing escape a second time stops this movement and returns everything to normal, but doesn't switch fullscreen. Pressing escape a third time switches fullscreen and causes the same issue. No other object seems to have this difficulty (though the PC is the only animated object on the screen, which may be why). The escape key isn't referenced anywhere else in my game, and I tried it with another key that I hadn't yet used (F), and the same problem occurred. Does someone know what could possibly be going on?
 
I

IJsandwich

Guest
Here's the relevant create event

can_move = true;
image_speed = 0;
walkSpeed = 1.5;
collisionSpeed = walkSpeed + 4.5;


And here's the step event

if (can_move) {
//Turning Against Walls
if (keyboard_check_pressed(ord("W"))){
sprite_index = spr_valerie_backface;
}
if (keyboard_check_pressed(ord("A"))){
sprite_index = spr_valerie_leftface;
}
if (keyboard_check_pressed(ord("S"))){
sprite_index = spr_valerie_frontface;
}
if (keyboard_check_pressed(ord("D"))){
sprite_index = spr_valerie_rightface;
}

//Walking

if(keyboard_check(ord("W")) and place_free(x, y - collisionSpeed)) {
y -= walkSpeed;
image_speed = walkSpeed;
sprite_index = spr_valerie_backface;
}
if(keyboard_check(ord("A")) and place_free(x - collisionSpeed, y)) {
x -= walkSpeed;
image_speed = walkSpeed;
sprite_index = spr_valerie_leftface;
}
if(keyboard_check(ord("S")) and place_free(x, y + collisionSpeed)) {
y += walkSpeed;
image_speed = walkSpeed;
sprite_index = spr_valerie_frontface;
}
if(keyboard_check(ord("D")) and place_free(x + collisionSpeed, y)) {
x += walkSpeed;
image_speed = walkSpeed;
sprite_index = spr_valerie_rightface;
}
if(keyboard_check(vk_nokey)) or ((keyboard_check(ord("W"))) and keyboard_check((ord("S")))) or ((keyboard_check(ord("A"))) and keyboard_check((ord("D")))){
image_speed = 0;
image_index = 0;
}
} else { image_speed = 0; image_index = 0;}


It may need some work but I can't understand why the fullscreen causes an issue when the escape key and fullscreen aren't referenced here nor anywhere else
 

obscene

Member
If you tab out, I think there is nothing to set image speed to 0. Your keyboard checks including nokey won't register. Possibly try setting can_move to false if the window loses or something similar.
 
I

IJsandwich

Guest
If you tab out, I think there is nothing to set image speed to 0. Your keyboard checks including nokey won't register. Possibly try setting can_move to false if the window loses or something similar.
I'm not sure what you mean by "tab out". If the keyboard checks aren't registering, could this be why I have to press escape twice? I did a very quick test where I set can_move to false for a short time while it switched to fullscreen and it didn't work, I still had to press escape a second time.
 
Top