(SOLVED) Doors - Going inside and outside of them


The doors in the example work on 2 objects, door indicator and the door itself (collision)
While entering the door, it checks if:
The door has (is collision with) an indicator and which one is it (A, B,C etc)
If it is: It finds another door that has (is collision with) the same indicator (A, B, C etc) and moves player there

Well I mean, most of the doors in the example just change scene but still puts you in the door that has the same indicator

How do I actually even achieve the same result? I tried several ways, not even the exact same but with no effect

hello @StS_PL ,
if I understand correctly you have for example
scene 1
door 1 (indicator A)
door 2 (indicator B)
door 3 (indicator C)

scene 2
door 1 (indicator B)
door 2 (indicator C)
door 3 (indicator A)

Your goal is that
in scene 1
if player collide at door 1, the scene 2 is called and the player is positioned on the door 3

in scene 2
If the player collider the door 1, the scene 1 is called and the player is positioned on door 2

It’s correct ?
Fist of all, create two object variable into indicator obejct:

and create a global variable
to store the indicator.

When player collide to a door:
store obj_indicator in glb_indicator
change scene at obj_scene value

at the beginning of the new scene
you have to move the player to glb_indicator value.


Are you sure you need separate Indicator objects?
You can add a global variable “DoorID” for example.
Then add a variable “ID” for the door object,
then on your 2 scenes in the instance variables set them to the appropriate values ​​- which door leads to which
If player collides with door object, set global var ID to Door ID
When you enter the scene you create the “Player” object at the position of the desired door, here are the events:


Making such doors for one scene turned out to be unnecessarily complicated, maybe someone will suggest a more concise way, but here’s how to do it:
Add globalvar “DoorID”
Add global bool “SwitchAllowed” (False by default)
Add object variable “ID” for your door object
Add object bool “JumpAllowed” for your door object (False by default)
Assign the same ID numbers to the instances of your doors that you want to connect



Well, I’ve decided to not do door behaviour in the same scene

But, idk what went wrong, this straight up doesn’t work, it worked before when instead of using CurrentSceneName() + WoodenDoor.VariableString(ID) I did CurrentSceneName() + "1" (but then it put me in the same scene, but in the same door I went into) (edit: actually it doesn’t work too, idk what worked before like that)

(I don’t want to hardcode every door every single scene)

another edit, sorry: I realized that it also counts the number, im so srupid, how do I not count it tho?
(as in I have scene1, I want to move to it from scene2 but it takes scene2 and adds the 1 to it making it scene21)

You probably need 2 variables for your doors, one that would tell to which scene it leads, and the second one that would tell to which door on that scene it leads

Yeah, after I got off my pc that came to mind, thanks
Will test tomorrow

SubStr(CurrentSceneName(), 0, 5) + WoodenDoor.VariableString(ID)

the 0 and 5 works like everything between those won’t be counted, right?
So if like, I would change the 5 into highter number it would still work, but with highter cap

just want to make shure

(edit:) it didn’t work

oookay well uhh, now for unknown reasons it doesn’t create the hitbox (thing with player behaviour) and leaves Player sprites (the thing on top of it) just floating where it was originally put



The 0 is the starting position, and the 5 is the length of the word “scene”. So if all your scenes are named: scene1, scene2, scene3… etc… then SubStr will take away the number at the end just like you asked. But it is kind of counter intuitive because you could just say it should go to “Scene + DoorID”. But I was just answering that small portion of this topic about taking away the number at the end.

I don’t have much time for large explanations so I made a small example project for you that might help.

Doors Example Project

These are the events used:

The “Repeat for each” is actually redundant, so you don’t have to use it.

Entering Doors

one thing, I have more than 1 main scene so I would still need to code it for each

You can use an external event.

I meant that each scene can vary in the names, some might have more or less letters

Then do what was told before, add 2 variables. One that holds the scene name and one that holds the door ID.

I did, but it doesn’t work (the character hitbox doesn’t spawn)

Why isn’t it in the scene already? You can position it at the door. Look at the example.

Did you use the debugger to see if it had been created? Maybe it’s somewhere else. Some other events might interfere.

I have updated the example slightly.

Example v2

You should be able to figure it out now.

(ps: yeah idk why I didnt put the hitbox before, also I wasn’t (your example), the way in example just didnt worked in mine somehow, probably bad transcribtion, but)

idk why it straight up ignores the “change position if variable of ID of Door…” no matter what, it would fix th problem with the “not moving to the door”

I may just be stupid at this point tbh


I need to add another variable that works as a “connector”
like “WentFromID” that would store previous scene’s ID number
(idk if I explained it right)


This is the way to do it!

(External event)

(Door variables)
GotoRoomID is used to move you to specific room with same ID (Move to Room2)
FromRoomtoID is used to detect teh door you exit through (If moved from Room2 to this room (Room1), move to this door)

(hardcoded room name detection)

Used for external event, gathered from room, name can be anything as long as it is the room’s name but without the number

Thank you all for help!
@Epicsleeper @7ToGo and (I guess) @jumpingj
I guess I will now work with the saving of what happened in the scene, like saving what enemies were killed or where they are, but I will figure that out