Request: Direction Fix on Player

Hey everybody, I'm looking for a simple plugin that automatically fixes the player's position upon starting the game.

I am doing a sort of scrolling game where the player would be constantly moving upwards, and thus their sprite should never use a Down, Left or Right Sprite. Even when moving left and right, I want them locked to be facing upwards.

I sort of missed it in the title, but I also want the player to be forced to be constantly moving upwards on the map, while retaining the controls to move left or right. This means Up and Down buttons must be effectively disabled. The only controls should be left and right.
no need for a plugin, this can be done much easier

just set every tile in your tileset with the "ladder" flag.
That was originally intended to be to simulate climbing, but it has the same effect as you want: have the player always face up no matter which direction he goes.

as for the second part: depending on what exactly you want it may be simulated by adding a moveroute to the player that goes up.
this would not completely disable going down, but it would move the player up again depending on the frequency and speed set for the moveroute. So the player would be much more limited and slower when going down, and start to go up as soon as he stops pressing down/brake
[Edit: oh, the ladder tile flag, very elegant! 😂]

Spoiler: Alternative "always face up" via move route
The "always face up" thing can be done with a simple two-page event, e.g.
  1. Conditions: (None), Trigger: Autorun, Contents:
    Code:
    ◆Set Movement Route:Player (Wait)
    :                  :◇Turn Up
    :                  :◇Direction Fix ON
    ◆Control Self Switch:A = ON

  2. Conditions: Self-Switch A is ON, Trigger: Action Button, Contents:
    Code:
    ◆Comment:(it does nothing now)
...then just don't use Direction Fix OFF on the player character at any point during the game. 🙂

For "always move up", I've found the typical "Conditional Branch > Button is pressed down to choose a move route" approaches are generally unsatisfactory for one reason or another, allowing too much, or not enough, freedom. You may be interested in this move route script, though:
Code:
this.setMoveSpeed(Input.isPressed('down') ? 3 : 4); if (Input.isPressed('left')) { this.moveDiagonally(4, 8); } else if (Input.isPressed('right')) { this.moveDiagonally(6, 8); } else { this.moveStraight(8); }; if (!this.isMovementSucceeded()) this._moveRoute.repeat = false;
Basically, if you stick that in a repeating move route it'll make the player continuously move either straight up, or diagonally left/right based on directional input. There's also a couple of other parts to it, which you might want to remove:
  • This part slows movement if the player's trying to move down (they'll still move up, just more slowly):
    Code:
    this.setMoveSpeed(Input.isPressed('down') ? 3 : 4);
  • This part ends the repeating movement if the player collides with something:
    Code:
    if (!this.isMovementSucceeded()) this._moveRoute.repeat = false;
Put the script as the only entry in a repeating move route and it should do the trick! Note that if you also need the direction fix thing, you should put that in a separate move route, e.g.
Code:
◆Set Movement Route:Player (Wait)
:                  :◇Direction Fix ON
◆Set Movement Route:Player (Repeat, Skip)
:                  :◇Script:if (Input.isPressed('left')) { this.moveDiagonally(4, 8); } else if (Input.isPressed('right')) { this.moveDiagonally(6, 8); } else { this.moveStraight(8); };
◆Control Self Switch:A = ON
[Edit: oh, the ladder tile flag, very elegant! 😂]

Spoiler: Alternative "always face up" via move route
The "always face up" thing can be done with a simple two-page event, e.g.
  1. Conditions: (None), Trigger: Autorun, Contents:
    Code:
    ◆Set Movement Route:Player (Wait)
    :                  :◇Turn Up
    :                  :◇Direction Fix ON
    ◆Control Self Switch:A = ON

  2. Conditions: Self-Switch A is ON, Trigger: Action Button, Contents:
    Code:
    ◆Comment:(it does nothing now)
...then just don't use Direction Fix OFF on the player character at any point during the game. 🙂

For "always move up", I've found the typical "Conditional Branch > Button is pressed down to choose a move route" approaches are generally unsatisfactory for one reason or another, allowing too much, or not enough, freedom. You may be interested in this move route script, though:
Code:
this.setMoveSpeed(Input.isPressed('down') ? 3 : 4); if (Input.isPressed('left')) { this.moveDiagonally(4, 8); } else if (Input.isPressed('right')) { this.moveDiagonally(6, 8); } else { this.moveStraight(8); }; if (!this.isMovementSucceeded()) this._moveRoute.repeat = false;
Basically, if you stick that in a repeating move route it'll make the player continuously move either straight up, or diagonally left/right based on directional input. There's also a couple of other parts to it, which you might want to remove:
  • This part () slows movement if the player's trying to move down (they'll still move up, just more slowly):
    Code:
    this.setMoveSpeed(Input.isPressed('down') ? 3 : 4);
  • This part ends the repeating movement if the player collides with something:
    Code:
    if (!this.isMovementSucceeded()) this._moveRoute.repeat = false;
Put the script as the only entry in a repeating move route and it should do the trick! Note that if you also need the direction fix thing, you should put that in a separate move route, e.g.
Code:
◆Set Movement Route:Player (Wait)
:                  :◇Direction Fix ON
◆Set Movement Route:Player (Repeat, Skip)
:                  :◇Script:if (Input.isPressed('left')) { this.moveDiagonally(4, 8); } else if (Input.isPressed('right')) { this.moveDiagonally(6, 8); } else { this.moveStraight(8); };
◆Control Self Switch:A = ON


I'm going to give this a shot. I feel a bit silly I forgot we could direction fix the player through move routes, big bacon moment.

The rest is incredibly helpful and I'm going to see if it works right when implented.
no need for a plugin, this can be done much easier

just set every tile in your tileset with the "ladder" flag.
That was originally intended to be to simulate climbing, but it has the same effect as you want: have the player always face up no matter which direction he goes.

as for the second part: depending on what exactly you want it may be simulated by adding a moveroute to the player that goes up.
this would not completely disable going down, but it would move the player up again depending on the frequency and speed set for the moveroute. So the player would be much more limited and slower when going down, and start to go up as soon as he stops pressing down/brake

Thanks for your response as well. It sounds like the move route thing won't work for me in that case. I don't want any sort of braking or going back - just a constant pace forward with side to side controls.
Hope it works out! (I've actually been looking into writing a more comprehensive plugin for automatic/coupled movements, but I doubt it'll be released any time soon. 😴)
Hope it works out! (I've actually been looking into writing a more comprehensive plugin for automatic/coupled movements, but I doubt it'll be released any time soon. 😴)

I just tried it out and it works perfectly for what I was going for, thank you so much 🙂
@Revival If your querry is fully solved, please report you post and someone will close it.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/request-direction-fix-on-player.114965/