Dear fellow developers
I've recently run into a rather strange issue with my current project.
Some Info: I'm making a platforming game with a overworld for level selection.
Now, I create a ds_map of the levels with the key being a number from 1 to the total number of levels, and the value being the corresponding room ID.
So under key 1 there is the room ID of level 1 and so on. I do this, so I can later enter the levels according the a variable called var_lvl, holding the current level number.
So at the overworld, this variable (var_lvl) is changed through a collision between the player object and the different level icons on the overworld map. If you move your player over the level 1 icon, the variable is changed to var_lvl=1.
In a controller object, I do the following:
Inside the player object of the overworld map:
If I run the game and try this out, it throws me an error that tells me that room ID 13000163 (or similar, I'm not currently on my dev-PC).
If I draw the variable r_lvl1 (which holds the room ID) onto the screen, it simply says "1" or "2". So what's going on here? If the variable clearly holds "1" or "2", then how come does it searches for a strange number if I write the value into a DS and try to read it later? Is there some strange behavior I'm not aware of?
It seemed like such a simple thing, so it somehow frustrates me that it's not working as I think it should :/
Could anyone clear things up for me? That would be much appreciated!
If you need further clarification about an aspect of my problem, feel free to ask!
Best regards,
Toby
I've recently run into a rather strange issue with my current project.
Some Info: I'm making a platforming game with a overworld for level selection.
Now, I create a ds_map of the levels with the key being a number from 1 to the total number of levels, and the value being the corresponding room ID.
So under key 1 there is the room ID of level 1 and so on. I do this, so I can later enter the levels according the a variable called var_lvl, holding the current level number.
So at the overworld, this variable (var_lvl) is changed through a collision between the player object and the different level icons on the overworld map. If you move your player over the level 1 icon, the variable is changed to var_lvl=1.
In a controller object, I do the following:
Code:
//create the ds_map
global.dsm_levels=ds_map_create();
//instert the room IDs into the
ds_map_replace(global.dsm_levels, 1, r_lvl1);
ds_map_replace(global.dsm_levels, 2, r_lvl2);
//...and so on.
Code:
if keyboard_check_pressed(vk_space)
{
room_goto(global.dsm_levels[? var_lvl]
}
If I draw the variable r_lvl1 (which holds the room ID) onto the screen, it simply says "1" or "2". So what's going on here? If the variable clearly holds "1" or "2", then how come does it searches for a strange number if I write the value into a DS and try to read it later? Is there some strange behavior I'm not aware of?
It seemed like such a simple thing, so it somehow frustrates me that it's not working as I think it should :/
Could anyone clear things up for me? That would be much appreciated!
If you need further clarification about an aspect of my problem, feel free to ask!
Best regards,
Toby