FoxyOfJungle
Kazan Games
I tried to look in the manual but I couldn't find exactly what I wanted, it's because I'm using structs and I ended up in a situation where I need to use one function inside the other, but I saw people using
And I also have a problem, when I press Enter and call the function
Any idea?
Thanks.
static
, but I don't know what the function is, I click on the function and it doesn't open anything in the manual.
GML:
function obj_instance(_x, _y) constructor
{
idd = -1;
xx = _x;
yy = _y;
v_text = "Test";
static core = function()
{
// step
if keyboard_check_pressed(vk_enter)
{
this_is_a_function("room_level1");
}
// draw
draw_text(10, 10, v_text);
}
}
And I also have a problem, when I press Enter and call the function
this_is_a_function
, it appears an error, indicating that this is a variable and was not found, but it is actually a global function.
GML:
function this_is_a_function(index)
{
// destroy all instances
global.game_instances[0] = 0;
global.game_instances_n = 0;
// set the id of the new room
for (var r=0; r<array_length(global.game_room); r+=1)
{
var _struct = global.game_room[r];
var _struct_array = variable_struct_get_names(_struct);
for (var i=0; i<array_length(_struct_array); i+=1;)
{
if (variable_struct_get(_struct, _struct_array[i]) == index)
{
var _level = _struct.indx;
global.game_room_index = _level;
}
}
}
// enable room loading
global.game_room_can_load = true;
}
Thanks.