• 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!

GameMaker Why do the screen freeze in room-18?

D

Dwighty4000

Guest
I have a game where there are 21 rooms. Everything runs as usual, the player is not persistent and is placed in each additional room. However, for strange reasons, I can no longer move in the game as soon as I cross the door of Raum18 and I do not get an error message. No matter whether in debug mode or in standard.
What could be the reason that the game always freezes exactly in room 18 although the function does not differ from the change of room to the other rooms which worked perfectly in comparison ...

This is the script from the collision event with the door, that should you teleport in the next room:
Code:
/// @description Normal EscapeTeleport
// Raum Teleport von 1 bis 20...
if (global.raumcounter > 0 && global.raumcounter < 20)
{
   #region zufallaelligeopensounds
   zufallssound = random_range(1, 3);
  
   if (zufallssound >= 1 && zufallssound <= 2)
   {
       if (!audio_is_playing(snd_open_door_stumpf))
       {
           audio_play_sound(snd_open_door_stumpf, 80, false);
       }
   }
   if (zufallssound >= 2 && zufallssound <= 3)
   {
       if (!audio_is_playing(snd_open_door_hallig))
       {
           audio_play_sound(snd_open_door_hallig, 80, false);
       }
   }
   #endregion
  
   global.raumcounter++;
  
   room_goto(targetroom);
   obj_player_escaperun_v2.x = targetroomX;
   obj_player_escaperun_v2.y = targetroomY;
  
}


//wenn durch eine tuer gegangen wird, dann besteht die changse das die yandere von dem spieler ablaesst...
if (global.yandereaktiv == true)
{
   zufallschangse = random_range(1, 4);
  
   if (zufallschangse > 1 && zufallschangse < 2)
   {
       global.yandereaktiv = false;
       obj_yandere_escaperun_v2.visible = false;
   }
}
And this is the creation code script:
Code:
//INFO: Raum 1 wird in raumcounternummer = 0 verwendet und wurde ja generiert im Aufwachraum...
kneipenstrassetarget = room_kneipenstrasse;


   //Raum 1
   if (global.raumcounter == 1)
   {
       targetroom = room_escaperun_2;
       targetroomX = 2800;
       targetroomY = 4300;
   }
   //Raum 2
   if (global.raumcounter == 2)
   {
       targetroom = room_escaperun_3;
       targetroomX = 4200;
       targetroomY = 4300;
   }
   //Raum 3
   if (global.raumcounter == 3)
   {
       targetroom = room_escaperun_4;
       targetroomX = 2300;
       targetroomY = 3250;
   }
   //Raum 4
   if (global.raumcounter == 4)
   {
       targetroom = room_escaperun_5;
       targetroomX = 1250;
       targetroomY = 5700;
   }
   //Raum 5
   if (global.raumcounter == 5)
   {
       targetroom = room_escaperun_6;
       targetroomX = 19110;
       targetroomY = 2500;
   }
   //Raum 6
   if (global.raumcounter == 6)
   {
       targetroom = room_escaperun_7;
       targetroomX = 2300;
       targetroomY = 3000;
   }
   //Raum 7
   if (global.raumcounter == 7)
   {
       targetroom = room_escaperun_8;
       targetroomX = 1000;
       targetroomY = 4000;
   }
   //Raum 8
   if (global.raumcounter == 8)
   {
       targetroom = room_escaperun_9;
       targetroomX = 6100;
       targetroomY = 4000;
   }
   //Raum 9
   if (global.raumcounter == 9)
   {
       targetroom = room_escaperun_10;
       targetroomX = 4800;
       targetroomY = 1000;
   }
   //Raum 10
   if (global.raumcounter == 10)
   {
       targetroom = room_escaperun_11;
       targetroomX = 2550;
       targetroomY = 4200;
   }
   //Raum 11
   if (global.raumcounter == 11)
   {
       targetroom = room_escaperun_12;
       targetroomX = 4600;
       targetroomY = 4700;
   }
   //Raum 12
   if (global.raumcounter == 12)
   {
       targetroom = room_escaperun_13;
       targetroomX = 1000;
       targetroomY = 3700;
   }
   //Raum 13
   if (global.raumcounter == 13)
   {
       targetroom = room_escaperun_14;
       targetroomX = 750;
       targetroomY = 650;
   }
   //Raum 14
   if (global.raumcounter == 14)
   {
       targetroom = room_escaperun_15;
       targetroomX = 400;
       targetroomY = 2100;
   }
   //Raum 15
   if (global.raumcounter == 15)
   {
       targetroom = room_escaperun_16;
       targetroomX = 1600;
       targetroomY = 3700;
   }
   //Raum 16
   if (global.raumcounter == 16)
   {
       targetroom = room_escaperun_17;
       targetroomX = 3300;
       targetroomY = 4750;
   }
   //Raum 17
   if (global.raumcounter == 17)
   {
       targetroom = room_escaperun_18;
       targetroomX = 3300;
       targetroomY = 3700;
   }
   //Raum 18
   if (global.raumcounter == 18)
   {
       targetroom = room_escaperun_19;
       targetroomX = 1500;
       targetroomY = 6750;
   }
   //Raum 19
   if (global.raumcounter == 19)
   {
       targetroom = room_escaperun_20;
       targetroomX = 9150;
       targetroomY = 2600;
   }
  
   //Raum 20 = Ab zum Exitgate (Es sieht cooler aus wenn 20 auch der finale Exitgate ist...)
   if (global.raumcounter == 20)
   {
       targetroom = room_exitgate;
       targetroomX = 1790;
       targetroomY = 2240;
   }
The problem is, why do the game freeze, if the player colide with the door from Room 18, that should teleport the player into the room: "room_escaperun_19" ?
because the teleport fuction should be the same like the other 1-20 room teleports...
 

SeraphSword

Member
The only thing I can think of is either a problem with the room's dimensions (your targetroomX and targetroomY are trying to go outside the room), or something to do with the combination of the global.raumcounter++ and the global.raumcounter < 20 in the collision check. I don't have time to look too deep at the moment though, but I'll try to come back to it again if you don't find a solution.
 
D

Dwighty4000

Guest
The only thing I can think of is either a problem with the room's dimensions (your targetroomX and targetroomY are trying to go outside the room), or something to do with the combination of the global.raumcounter++ and the global.raumcounter < 20 in the collision check. I don't have time to look too deep at the moment though, but I'll try to come back to it again if you don't find a solution.
I was able to solve the problem for the time being by deleting the room and completely expanding it with objects.
Then it is no longer frozen...
 
Top