I want to make my elevators teleport my player character to different floors of the game’s map. The player can enter, go up or down, and stop using the elevator by pressing keys.
You can make the Player teleport by putting a Condition so that when the Up(AnyKey) is pressed then Set the Position of Player to a Empty Hidden Object . Put the Hidden Object where you want the player to teleport to . Then in the code of Set the position type
X Position = hiddenobjname.X()
Y Position = hiddenobjname.Y()
Your picture shows the doors to the elevator, not the actual elevator shaft and elevator. If you plan on moving the green doors of level 1 up, then won’t the level 2 door get in the way? Or do you want this: when the player contacts an elevator door then the player would be hidden while it went up to the next level and then be visible again as it comes out of the level 2 door? Or have I just misunderstood everything haha?
Yeah, something like that.
I think if you tell us what you’ve tried to do and what didn’t work it will help to get you better answers. But here’s some more anyway.
I’m using the word person to mean the person playing the game and player to mean the character in the game.
Is the person going to press a keyboard button to say that they want to go up or down in the elevator? Like, what is the trigger for it? And will the person select which level they want to go to? When the player collides with an elevator a number selection could appear above the door and the person presses which number they want on their keyboard.
If all the elevator doors are in a group then you could say when player is in collision with elevator door and the person presses the number for the level they want or whatever it is, then change the Y position of the player to the Y position of the destination level.
So this is what I want, I need to press “E” key to enter the elevator, which also doubles in dodging bullets fired from enemies(but that part can come later), press “W” or “S” key to go up or down a floor. There’s also delay between leveling to simulate elevator going up or down.
I think you need to do some more thinking. What is the trigger for the player to stop at a level? Is it when the person takes their finger off the w/s key? But if you’re hiding the player between levels then how would the person know where the player is? Or does the player just stop at every level and the person decides whether or not to press w/s again? If the player is visible then it seems easier.
I see from your stats that you’re not a beginner so you will get the best results from your question if you have a go at the events yourself and then show them to us if they’re not working.
But first ask yourself all the questions of what starts and stops the movement. Once you have that defined, you’ve just about written your events.
And as for the movement itself, my platformer knowledge is very limited but you could try a hidden platform of ladder type.
This is my first answer and I am new to GDevelop but I think I have your solution. I also have multiple elevator shafts in my platformer, with different numbers of stops/levels. I use a two part sprite for the elevator, an inside/background, and the closing doors. When a player enters the elevator I have the doors behind (lower Z order) animate to open, revealing the “inside” of the car. When the doors are wide open they change to a higher Z order to “close” in front of the player. I then hide the player. His movement is controlled by object vars that tell the car where it can move to depending on if there are stops above or below. The player is then tweened to that position and if they press “X” everything is reversed and they are released. I use a mix of scene vars, object vars, and timers to control the movement position of the player.
Check out the Event Sheet, I am terrible at explaining things, and hit me up with any questions please. Learning involves a lot of trial and error, and for people with limited time (like me) getting hung up on getting elevators to work for a week can kill your mojo.
![Screen Shot 2022-07-08 at 8.55.29 PM|543x499]
I just reread what you asked. If you want them to teleport (not show the travel) just use a position move on the player to the same coordinates as the tween. Depending on how you have your camera setup you may also need to move the camera itself in the same event so they travel together. I use this when I have the player walk through a camera facing door.