Player clipping through walls for no reason and locking movement direction.

Hi all,

I'm currently making a mini game where my player is "locked" to move horizontally by a parallel event that might cause some clipping. It's also no the best way to "lock" movement, though I haven't found any other way yet. I guess my question has two parts. This is the small conditional branch I made to move sideways only using the arrow keys:

Loop
◆If:Button
is pressed down
◆Set Movement Route:Player (Wait)
: :◇Move Left
◆
:Else
◆If:Button
is pressed down
◆Set Movement Route:Player (Wait)
: :◇Move Right
◆
:Else
◆If:Button [Up] is pressed down
◆Set Movement Route:Player (Wait)
: :◇Move Left
◆
:Else
◆If:Button [Down] is pressed down
◆Set Movement Route:Player (Wait)
: :◇Move Right
◆
:End
◆
:End
◆
:End
◆
:End

Now, I got my character stuck in a box for this mini-game, as she is trying to catch falling objects. When she reaches a wall on the side though, first she gets stuck beside it, and after +- 20 seconds she clips through it. This is question one. Why on earth is my movement route (as I suspect) somehow overruling the hitbox of the wall? The second question is if anybody knows a better way to prevent your player from moving certain directions that locks out i.e. mouse or tapping movement as well.

Sorry for the long text, and thank you for reading!

2021-11-14 (5).png
What is going on with the top of your event? The first two conditionals say they're checking for a button, but don't actually show which button they're checking for.

Aside from that, I'm not sure why it would end up clipping through the wall, but I agree it's not a perfect solution. I would suggest a plugin to disable vertical movement.
What is going on with the top of your event? The first two conditionals say they're checking for a button, but don't actually show which button they're checking for.

Aside from that, I'm not sure why it would end up clipping through the wall, but I agree it's not a perfect solution. I would suggest a plugin to disable vertical movement.
Hi and thanks for your reply. I don't know why the Left and and Right of the buttons did not get included in the text, it seems like they get deleted because they are used as mark-up in this text for some reason. Type them as [UP] or [Down] and they dissapear. Though I can assure you they are there. I've been trying for a while (few hours) to fix things such as finding a plugin to disable movement in one direction, though the only thing I found so far is some weird directional fix from when it wasn't included in MV yet. Do you have any suggestions for a plugin?
I found a simple plugin! Since it took my a while, I will link it here! It also solved my wall clipping. With thanks to himeworks.

Hi and thanks for your reply. I don't know why the Left and and Right of the buttons did not get included in the text, it seems like they get deleted because they are used as mark-up in this text for some reason.
Yeah, anything you do with brackets should be encased in the Code tag (the </> icon) or it'll be interpreted as BBCode.

But why are you checking for left and right, anyway? Aren't they still left and right?
I've been trying for a while (few hours) to fix things such as finding a plugin to disable movement in one direction, though the only thing I found so far is some weird directional fix from when it wasn't included in MV yet.
Paste this into a text editor, save it as a .js file in your plugin folder and add it in the plugin manager.
Code:
Game_Player.prototype.moveByInput = function() {
    if (!this.isMoving() && this.canMove()) {
        var direction = this.getInputDirection();
        if ($gameSwitches.value(X)==true && (direction==8 || direction==2))
            direction=0;
        if (direction > 0) {
            $gameTemp.clearDestination();
        } else if ($gameTemp.isDestinationValid()){
            var x = $gameTemp.destinationX();
            var y = $gameTemp.destinationY();
            direction = this.findDirectionTo(x, y);
        }
        if (direction > 0) {
            this.executeMove(direction);
        }
    }
};

Replace the X on the fourth line with the number of a switch you want to use. When it's on, pressing up and down won't do anything.

This doesn't affect mouse controls, so I'd suggest just disabling mouse for your minigame (with a nice big text message saying so!).

Original thread: https://forums.rpgmakerweb.com/threads/player-clipping-through-walls-for-no-reason-and-locking-movement-direction.142127/