Star Wars Style Trash Compactor

I want to design a compactor with walls on opposite sides moving toward each other, and kill the player if he cannot get out in time.

Any suggestion for how the coding can be done?
Pretty simple I think, walls are moving events, on event touch-death. You can also check X positions of the walls to check if they are on close to each other, because without this only touching the wall will cause death.
Pretty simple I think, walls are moving events, on event touch-death. You can also check X positions of the walls to check if they are on close to each other, because without this only touching the wall will cause death.

Thanks, any idea for how to check X position? I am noob.
Thanks, any idea for how to check X position? I am noob.
On every event step, use function "Get Location Info" (tab 3), then assign this event Map X to variable, let's say "left wall X". Same with 2nd wall, but assign to another variable. Then compare them (substraction can do this), and if difference is 2 or less, then if event touches player -> cause death.

Original thread: https://forums.rpgmakerweb.com/threads/star-wars-style-trash-compactor.129966/