lalileloluly
Member
First, thanks a lot for taking the time to read and help. I try beforehand to read the documentation and solve it by myself. Disclaimer for grammar : English is not my first language
There is an object that can go far from the player sprite.
Sometimes it can go out of the camera and the room. (room and camera are, most of the time the same size).
How do I detect that this object is out of the room. And then use a timer for this object being outside.
I have looked at the documentation, I know wrap to make an object go out.
I have tried in the step event object the following code :
And I have tried in the event "Outside Room" with the second block of code :
Note, in the create event of the object, i declare
I get the following error message when in-game, the object move outside the room with the event "outside room" :
And even if the variable is declare in create, it seems not to find it. Either, I am doing something wrong, either the outside room is not a good friend.
Either way, it might be better to have the outside room information not in the event outside room
There is an object that can go far from the player sprite.
Sometimes it can go out of the camera and the room. (room and camera are, most of the time the same size).
How do I detect that this object is out of the room. And then use a timer for this object being outside.
I have looked at the documentation, I know wrap to make an object go out.
I have tried in the step event object the following code :
And I have tried in the event "Outside Room" with the second block of code :
Note, in the create event of the object, i declare
GML:
if(place_meeting(x,y,room)){
time_help_message1 += 1;
if (time_help_message1 >= 3*60){
draw_text(room_width/2, room_height/2+100, "Push 'R' to restart level");
}
else if (keyboard_check_pressed(ord("R"))){
time_help_message1 = 0;
}
}
GML:
// in the create event:
time_help_message1 = 0; // timer for when object is outside
// In the OUTSIDE ROOM Event
time_help_message1 += 1;
if (time_help_message1 >= 2*60){
draw_text(room_width/2, room_height/2+100, "Push 'R' to restart level");
}
else if (keyboard_check_pressed(ord("R"))){
time_help_message1 = 0;
}
I get the following error message when in-game, the object move outside the room with the event "outside room" :
And even if the variable is declare in create, it seems not to find it. Either, I am doing something wrong, either the outside room is not a good friend.
Either way, it might be better to have the outside room information not in the event outside room
Code:
############################################################################################
FATAL ERROR in
action number 1
of Other Event: Outside Room
for object obj_rotation:
Variable box_around_player_not_auto.time_help_message1(100007, -2147483648) not set before reading it.
at gml_Object_obj_rotation_Other_0 (line 4) - time_help_message1 += 1;
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_obj_rotation_Other_0 (line 4)