@Quimey Implementation questions should go in the appropriate Support forum, not Game Mechanics Design (which is for discussion about pure design - things like game balance and psychological flow).
I'm moving this to RPG Maker MV Support based on your profile; if you're asking about a different engine please report this post and let us know which one.
I've done this before in my game
timeblazer (except the player is constantly running forward as you steer them left/right); it's harder than it looks. What you actually want to do is keep the player locked in place on the screen, and
move the rocks up instead of moving the player down. The rocks will need to be events, obviously. You may need to set their Direction Fix ON. If it doesn't screw up your gameplay, set their Through to ON as well. Set their move frequency to the max and their move speed to whatever you think is appropriate, and give them a repeating custom move route that simply moves them up.
If you don't want to make hundreds of rock events (this can cause lag), you can occasionally reset them to the bottom of the map using events ("Set Event Location").
Now, you simply need to stop your player from moving up or down. There are two possible ways to do this:
The easier way is to simply create two rows of invisible events directly above and below the player, all the way across the screen from left to right. Make sure their Through is OFF and make sure their Priority is Same As Player (if it's Below Player, the player will be able to walk through them). The player will still be able to turn up and down but will only be able to move left and right.
The harder, but more elegant, way to do this is to use a bit of coding to make the normal arrow keys' functions dependent on a Switch. If you don't know JavaScript, you will need to ask for some help on the JS Plugin Requests board. But as a starter, here's what the methods looked like for me in Ruby:
Ruby:
#--------------------------------------------------------------------------
# * Processing of Movement via Input from Directional Buttons
#--------------------------------------------------------------------------
alias :move_by_input_if_possible :move_by_input
def move_by_input
return if (Input.dir4 == 2 && $game_switches[41] == false)
return if (Input.dir4 == 8 && $game_switches[42] == false)
return if (Input.dir4 == 4 && $game_switches[43] == false)
return if (Input.dir4 == 6 && $game_switches[44] == false)
move_by_input_if_possible
end
Essentially I set Switches 41, 42, 43, and 44 to lock out the Down, Up, Left, and Right arrows, respectively. While those switches are on, their respective movement won't happen unless it's forced by a Move Route. So for this falling among rocks minigame, I would turn Switches 41 and 42 ON to lock out Up and Down arrows, and then turn then back Off at the end of the minigame.
I see
@GustavoF gave you a much simpler solution above; definitely try that out first! (It will need to be a Parallel Process event) My instinct is that there will be some problems with janky movement and collisions with rocks; however, I could be wrong and that would be a much easier solution than I've offered.