A bit more work on my Godot game, mainly building out mechanic for world 3. Tonight it was building an old-style lift with a caged door that the player can use to travel between different heights. Turned out really well.
Animating the door was a slog, and if that was all I achieved this evening, I would’ve considered that a success. But I had a bit of time to code up the lift too. I was unsure of how to approach this at first: I knew I wanted to turn off player movement and collisions and move the player (and camera) along with the lift.
This turned out to be easier than I was anticipating. When the player enters the lift, all motion on the player is disabled (this was done by setting a “disable_motion” boolean which would break out of the players progress loop early if true) and the player node is reparented to the lift. The lift then moves to the target, taking the player with it. At the destination, the player’s original parent is restored and motion is enabled again, allowing the player to move freely. I also had to turn off camera motion smoothing before I reparented the player as it seems like some offset vectors were incorrect for a frame and it had the camera shoot to the right. This is done when the door closing animation plays, before the node is reparented which happens just before the lift moves.
There’s still work to do. The z-order seems to be messed up when the lift reaches it’s destination (the player appears in front of the doors as they open). And at the moment, the lift only goes in one direction. But I’m really happy with what was achieved tonight.