L
LWDIV
Guest
I need help by solving the error:
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Key Press Event for <Space> Key
for object object0:
Unable to find any instance for object index '2' name '<undefined>'
at gml_Object_object0_KeyPress_32 (line 13) - currentPath = path2.path_index;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_object0_KeyPress_32 (line 13)
___________________________________________
I setted up a fresh project with two objects. One oject is a red square to make it move on the path0, path1, path2 or path3. The second object is holding two globalvars currentLevel and currentPath. Depends on what level 0 to 3 currentLevel is set to, i am changing the path. Code below:
object1 code:
CreateEvent ->
globalvar currentPath;
currentPath = path0.path_index;
globalvar currentLevel;
currentLevel = 0;
object0 code:
spacebar pressed event ->
currentLevel = 0;
currentPath.path_endaction = path_action_stop;
if (currentLevel = 0) {
currentPath = path0.path_index;
path_start(path0, 2, path_action_reverse, false);
} else if (currentLevel = 1){
currentPath = path1.path_index;
path_start(path1, 2, path_action_reverse, false);
} else if (currentLevel = 2){
currentPath = path2.path_index;
path_start(path2, 2, path_action_reverse, false);
} else if (currentLevel = 3){
currentPath = path3.path_index;
path_start(path3, 2, path_action_reverse, false);
}
if (currentLevel < 4) {
currentLevel++;
} else {
currentLevel = 0;
}
What do i wrong?
___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Key Press Event for <Space> Key
for object object0:
Unable to find any instance for object index '2' name '<undefined>'
at gml_Object_object0_KeyPress_32 (line 13) - currentPath = path2.path_index;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_object0_KeyPress_32 (line 13)
___________________________________________
I setted up a fresh project with two objects. One oject is a red square to make it move on the path0, path1, path2 or path3. The second object is holding two globalvars currentLevel and currentPath. Depends on what level 0 to 3 currentLevel is set to, i am changing the path. Code below:
object1 code:
CreateEvent ->
globalvar currentPath;
currentPath = path0.path_index;
globalvar currentLevel;
currentLevel = 0;
object0 code:
spacebar pressed event ->
currentLevel = 0;
currentPath.path_endaction = path_action_stop;
if (currentLevel = 0) {
currentPath = path0.path_index;
path_start(path0, 2, path_action_reverse, false);
} else if (currentLevel = 1){
currentPath = path1.path_index;
path_start(path1, 2, path_action_reverse, false);
} else if (currentLevel = 2){
currentPath = path2.path_index;
path_start(path2, 2, path_action_reverse, false);
} else if (currentLevel = 3){
currentPath = path3.path_index;
path_start(path3, 2, path_action_reverse, false);
}
if (currentLevel < 4) {
currentLevel++;
} else {
currentLevel = 0;
}
What do i wrong?