• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

SOLVED game_restart() not restarting to intial room. Space Rocks Tutorial

F

floatingonthewater

Guest
Hello All,

I'm new to programming and have been going through the Space Rocks tutorial, but have run into a problem with the game_restart() function I can't figure out.

Within the switch(room) function I'm using the game_restart() function to restart the game when the player presses the enter button while in rm_win or rm_gameover. This should return the game to the initial room, rm_start, but for some reason after pressing enter the game returns to the second room, rm_game.

I have tried to troubleshoot this problem for the last couple of hours and still can't figure it out. As a test, I replaced game_restart() with room_goto(rm_start), and it works fine. Any thoughts?

I've attached some screenshots of the code.

-- I appreciate any and all help. If there is a better way to format my questions for future posts, please let me know. --


Thanks!
 

Attachments

SoapSud39

Member
try keyboard_check_pressed() instead of keyboard_check()

it might be because you're holding enter down for more than one frame, so the first room will immediately detect it when you restart. Since this tutorial doesn't have fancy transitions it's hard to tell, but I think you are restarting correctly.
 
F

floatingonthewater

Guest
That was the issue.

Thanks so much for your response!
 
Top