Make a state machine with four states: "look for player", "fall down", "sit on ground for a while", "slowly move up".
- The "look for player" state switches to the "fall down" state if the player is below the thwomp and close enough on the x axis.
- In the "fall down" state the object increases its vertical speed every step; if it hits ground, it switches to the "sit on ground for a while" state. (and stops moving down)
- In the "sit on ground" state, the object decreases a counter variable (which was set before the state transition). When zero, it switches to the "slowly move up" state.
- In the "slowly move up" state, the object moves up at a set speed. When it reaches its ystart position, it switches back to the "look for player" state.
Easiest way to make a state machine is having a variable
state, and a switch statement in the object's step event.