Avram
Member
I have some very odd behaviour happening when I'm switching from one room to another in a platform game I've been working on for far too long.
Here's a list of the rooms I currently have:
GAME SETUP
1. room_initialize - sets up some initialization code and goes straight to next room
2. room_title - title screen
3. room_levels - level select screen
4. room_settings - allows for adjustment of onscreen controls
5. room_about - credits
LEVELS
6. room_begin_001 - first level
7. room_first_big_room_002
8. room_bouncy_003
9. room_tall_004
etc.
I discovered that I can use numbers instead of room names to progress to certain levels and so I have a variable that keeps track of where the player has reached - global.level_reached. In the set-up, the value is 5 (so that the game begins at 6. room_begin_001).
The first odd thing is that when I have the player complete a room which is achieved by touching an end-of-level object the game jumps TWO levels whilst only increasing global.level_reached by one! Below is the code for the end-of-level object that kicks in when the player touches it. Anyone have any ideas what I'm doing wrong?
Here's a list of the rooms I currently have:
GAME SETUP
1. room_initialize - sets up some initialization code and goes straight to next room
2. room_title - title screen
3. room_levels - level select screen
4. room_settings - allows for adjustment of onscreen controls
5. room_about - credits
LEVELS
6. room_begin_001 - first level
7. room_first_big_room_002
8. room_bouncy_003
9. room_tall_004
etc.
I discovered that I can use numbers instead of room names to progress to certain levels and so I have a variable that keeps track of where the player has reached - global.level_reached. In the set-up, the value is 5 (so that the game begins at 6. room_begin_001).
The first odd thing is that when I have the player complete a room which is achieved by touching an end-of-level object the game jumps TWO levels whilst only increasing global.level_reached by one! Below is the code for the end-of-level object that kicks in when the player touches it. Anyone have any ideas what I'm doing wrong?
Code:
instance_create(0,0,obj_fade); //fade the screen
global.level_reached += 1; //advance counter to transition to the next level
room_goto(global.level_reached); //now go there!