Move Backward from currently facing direction

So this is a pretty simple question: I want my game to include sequences where you fight monsters on the map and you both loose HP each time you make contact. This works pretty well, but i need some form of "knockback" for the player. When I use the Movement route command though and do "1 step backward" that works fine, but I want the character to jump at the same time, and in the same direction. Here is an example event script:
Control Variables: #0004 zombie hp -= 20
If: zombie hp <= 0:
Erase Event
End
Change HP: Entire Party, -20
Play SE: Attack3 (90, 100, 0)
Set Movement Route: (Player)
Direction Fix ON
1 Step Backward
Jump: +0, +1 (This is the probem)
Direction Fix OFF
I haven't tested it, but I think this should do you.

Paste the below into a text editor, save as a *.js file, include as a plugin.

Then in your move route, press Script and enter this.jumpBack()

Code:
Game_Character.prototype.jumpBack = function()
{
    let dir = this.reverseDir(this.direction());
    if (!this.canPass(this.x, this.y, dir))
        return;
    let x = 0, y = 0;
    switch (dir)
    {
        case 2:
            y++;
            break;
        case 4:
            x--;
            break;
        case 8:
            y--;
            break;
        case 6:
            x++;
            break;
    }
    this.jump(x, y);
};

You may need to turn direction fix on before, then off after.
You can lock the players facing direction before you implement the jump and then unlock it after the jump

nevermind, you already tried that.
Am I missing something or do you not realize you can input negative values in the jump command?
Am I missing something or do you not realize you can input negative values in the jump command?
the point is that it needs to jump at the same time as the player moves back.
I haven't tested it, but I think this should do you.

Paste the below into a text editor, save as a *.js file, include as a plugin.

Then in your move route, press Script and enter this.jumpBack()

Code:
Game_Character.prototype.jumpBack = function()
{
    let dir = this.reverseDir(this.direction());
    if (!this.canPass(this.x, this.y, dir))
        return;
    let x = this.x, y = this.y;
    switch (dir)
    {
        case 2:
            y++;
            break;
        case 4:
            x--;
            break;
        case 8:
            y--;
            break;
        case 6:
            x++;
            break;
    }
    this.jump(x, y);
};

You may need to turn direction fix on before, then off after.
I am not very well versed in coding, but when i do this the character jumps miles back for some reason, not just one tile. Thanks anyway though
the point is that it needs to jump at the same time as the player moves back.
uhhh isn't jumping back also moving back? lol I'm confused.
Jump takes an offset, not coordinates. I fixed the code above.

uhhh isn't jumping back also moving back? lol I'm confused.
Jumping makes the sprite move in an upward parabola, to indicate...a jump. Just moving slides in a straight line with the walking motion.
Jump takes an offset, not coordinates. I fixed the code above.


Jumping makes the sprite move in an upward parabola, to indicate...a jump. Just moving slides in a straight line with the walking motion.
Works like a charm, many thanks!

Original thread: https://forums.rpgmakerweb.com/threads/move-backward-from-currently-facing-direction.166948/