(SOLVED) Interaction Delay

M

max734734

Guest
Hi again Forums! It's me again, looking for your awesome help once again.

Anyways, today's topic involves...doors!

Long story short, I've been working on a door system, that when you press the 'interact' button on the door, you'll travel to the other room, and vice versa.

The weird thing that I've encountered was a strange...delay I guess?

When we try to spam the 'Interact' button on the door, there would be some occasions when it'll immediately travel like normal, other times there would be a delay of sorts.

If it isn't a delay, then it's the code not reading it right. I mean we're sitting on the door, pressing the 'interact' button like 2-3+ times before it reads it and sends over to the next room.

Another thing I found weird was that, sometimes when I 'interact' with the door while jumping in the entry room, when I come back to it the player object is still falling down from the past instance.

So I'd like to ask, a couple of things.

1) Is it natural? For GM to like have delays for this kind of 'interaction' such that, spamming it may cause instances when it'll skip and you have to 'interact' again to enter the room.
If so, I'd like to see if is it possible to create a system that won't have such a delay?
The code I'm using right now consists of this,

scr_roomwarp
Code:
if keyboard_check (ord('E'))
{
    if place_meeting (x,y,obj_portalnext)
    room_goto(rm_stage)
}

if keyboard_check (ord('E'))
{
    if place_meeting (x,y,obj_portalexit)
    room_goto(rm_01)
}
obj_portalnext, rm_stage, rm_01
Visible & Persistent

Alternatively, is it possible to create a short period where the door animation would play finish first, before the player is transferred to the next room?

An example that I can relate to is the door system used in Megaman Zero/ZX, where you were stuck for a brief period before the screen fades to black and you've entered the room, something like that.

EDIT: In case I gave the wrong message, uh...the door system I meant were the ones that you needed to press the UP key to access, not the ones you would interact with by running into them.

2) About the 'Persistent' setting in Rooms and Objects...uh, does it affect the scenario I brought up, the one about where when the player jumps in the room, exits the room by the door, then come back to see the landing in progress. (Note, we proc the 'interact' switch when in mid-air, so the landing scenario is possible.)

All I know about the 'persistent' setting from tutorials is that it keeps objects interacted or something like that! I blame college for not being able to experiment more. @.@

That said, thanks for reading and hope to hear from you guys soon Thanks in advance!
 
Last edited by a moderator:
M

Maximus

Guest
Persistent means the object is not destroyed when leaving a room and is usually used for singletons (objects you only ever want one instance of). If you create this object when entering a room you will start making copies which could cause buggy behaviour.
 
S

stephen2017

Guest
If you know how long the animation took. You could set an alarm event when pressed to take you to the next room and play the animation. That way going to the next room wouldnt happen until that alarm happened??
 

Tornado

Member
If I undestood it correctly I think too you might have several doors on top of each oher. So it seems to you that you have to press one door several times, but they are probably different doors on the same spot.
 
O

Old_Bean

Guest
This might be unrelated but I've found that loading a new room from the keyboard_check and keyboard_check_pressed commands will register both in the original room, and the one you're changing to. Perhaps you're caught in a bit of a loop switching between the two rooms?

For "keyboard_check" (which you're using) it makes sense as it's continually checking for that key being pressed in.

Maybe try the keyboard_check_released command instead and see what happens?
 
M

max734734

Guest
@Maximus Yeah, I kinda found out about that yesterday, after setting some of the objects on 'persistent' and they showed up in the other rooms.

@stephen2017 That's the dream!...if I could make a door animate that is ._.
Though, I'm more worried about how to get the whole alarm system work, since I'm still a bit blurry on that whole aspect.

@Tornado That was the case, before we removed the excess doors, but weirdly enough it still happens, the whole delay part.

@Old_Bean Ah that sounds like a neato idea, we'll give it a go.

EDIT: The keyboard_check_released works!
...though, this does feel a bit odd, to 'let go' of a button to interact with a door ._.
But it works! So thanks for that btw, Old_Bean
 
M

Maximus

Guest
if it works with keyboard_check_released, it will probably work with keyboard_check_pressed too which might 'feel' beter.
 
Top