B
Bung
Guest
I currently have a 'key object' in my room which, if it is in contact with another object, and the enter key is released, the room restarts. When the same conditions are met, but those two objects are not in contact when the enter key is released, the game moves to the next room.
My player object is in the same room. When the enter key is released, it initiates it's animation, which freezes on the last frame. The animation is currently the same for both conditions with regards to the two objects either meeting or not meeting. I'd like to retain this animation for when alarm 0 is triggered and the game moves to the next room. I would like to implement a different animation for when alarm1 is triggered, and before the room restarts. Or, have no animation event at all.
My question is:
How can I refer to these two other objects in the player object's code, so as to trigger a different animation (or no animation) for when the room restarts. I am very new to GML and GMS2 (ten days left on my free trial) and am keen to learn. I have studied the manuals and the forums, but I'm struggling a little I'm afraid. I am also developing a frame of reference for many of the functions, so I thank you in advance for your patient guidance and assistance. I really do appreciate it.
Thank you very much in advance.
The Code for the key object that controls the room transition/restarts:
KEY OBJECT STEP EVENT
if (!place_meeting(x,y,obj_blocker)) and keyboard_check_released(vk_enter) and !instance_exists(obj_fade)
{
alarm[0] = 200
}
if place_meeting(x,y,obj_blocker) and keyboard_check_released(vk_enter) and !instance_exists(obj_fade)
{
alarm[1] = 150
}
PLAYER OBJECT STEP EVENT
x = x + hsp
if place_meeting(x,y,obj_wall)
{
x = x - hsp
}
if keyboard_check_released(vk_enter)
{
sprite_index = spr_skycheck;
}
if image_index >= 41
{
image_speed = 0
}
My player object is in the same room. When the enter key is released, it initiates it's animation, which freezes on the last frame. The animation is currently the same for both conditions with regards to the two objects either meeting or not meeting. I'd like to retain this animation for when alarm 0 is triggered and the game moves to the next room. I would like to implement a different animation for when alarm1 is triggered, and before the room restarts. Or, have no animation event at all.
My question is:
How can I refer to these two other objects in the player object's code, so as to trigger a different animation (or no animation) for when the room restarts. I am very new to GML and GMS2 (ten days left on my free trial) and am keen to learn. I have studied the manuals and the forums, but I'm struggling a little I'm afraid. I am also developing a frame of reference for many of the functions, so I thank you in advance for your patient guidance and assistance. I really do appreciate it.
Thank you very much in advance.
The Code for the key object that controls the room transition/restarts:
KEY OBJECT STEP EVENT
if (!place_meeting(x,y,obj_blocker)) and keyboard_check_released(vk_enter) and !instance_exists(obj_fade)
{
alarm[0] = 200
}
if place_meeting(x,y,obj_blocker) and keyboard_check_released(vk_enter) and !instance_exists(obj_fade)
{
alarm[1] = 150
}
PLAYER OBJECT STEP EVENT
x = x + hsp
if place_meeting(x,y,obj_wall)
{
x = x - hsp
}
if keyboard_check_released(vk_enter)
{
sprite_index = spr_skycheck;
}
if image_index >= 41
{
image_speed = 0
}