Hello. Is there a way to make it that if the player enters a room a second time, an event can happen?
like, if the player enters a room for the first time, a door is open.
But if the player enters the room a second time, the door is closed and remains to be closed upon other entries.
When the game starts, have a variable set to 0. Then just call a function that sets it to 1 in whatever your "event" code is that needs it to change. Then just do if statements to check if it's zero or 1 and set the tiles accordingly. If you want it to trigger when the player sets foot in a certain room you can do a simple room name check by using event.room "name" then nest the if statements.
Then in you could use the draw function or similar to swap tiles based on that room name check.
on load do
on SomeFunction do
if event.room=="RoomName" then
if EnterRoom==0 then
tell "door" to
elseif EnterRoom==1 then
//do something else
I think that's what you were asking?
You can't do "swap" if the tile is not on screen, otherwise it displays in the current room not in the correct one, so swaps have to be done when the room is loaded using that kind of room check.
I think what you’d want to do is just add an
enter event handler to this room’s script. Something like:
on enter do
if visits>0 then
tell door_x,door_y to // door_x and door_y are the coordinates of the door you want to close
swap “closed door” // “closed door” is the name of your closed door tile, a solid Sprite or World tile
visits += 1