Character pixel shift during cutscene

Hi folks,

I'm in the process of building a cutscene, with two characters on a couch and want to give the impression that they are scooting across to one another. Now, I could do this using a custom animation, but this would be SO much easier if there was a way to just pixel shift the two event images which are next to each other, particularly as I could render multiple interactions without needing to do custom graphics for each. Is this at all possible either with base MZ, or with any of the VS plugins or compatible plugins?

To be clear the event doesnt necessarily need to be free of the grid, I just need to shift the event image (which is what i would do on a spritesheet manually if there is no script way to do it).

Cheers,

Steven
by default the engine knows only one form of pixel shift for the sprites, and that is a fixed distance.

All regular sprites are shifted 8 pixel up to make them appear to walk inside the grid instead of on the grid borders.
This shift can be disabled by placing a ! in front of the filename as that denotes an object sprite like the doors. With the ! the sprites will conform absolutely to the grid.

I think there are also script commands to place events mid-move between two grid positions, but those have limitations as well and I don't know if those would fit your ideas. And I don't know those commands anyway, you'll have to search for them yourself.
Hey Andar,

No I don't think that will work. Thats a sprite sheet move. What I'm talking about is one event having its image slide left say 6 pixels and the other event slide right the same 6 pixels to put them together as if they are scooting closer on a couch. I would also want to be able to slide them back apart afterwards. As I said, I can just animate this and have the image move across in the sprite sheet. But I was hoping for a more controlled way to do it. Similar to how a jump is done for example.
A couple of possibilities:
  • Use a script call like this:
    JavaScript:
    const char = $gameMap.event(1);
    // move 6 pixels left from actual position
    char._realX = char.x - 6/48;
    To prevent the character from sliding back to their actual position, this must be run every frame.


  • Use a small plugin, e.g.
    Spoiler: Plugin code
    JavaScript:
    /*:
     * @target MZ
     * @plugindesc Shift map characters left/right using script calls.
     * @author Caethyril
     * @help Use this script call to change a character's X offset:
     *       character._offsetX = value;
     *  e.g. $gameMap.event(1)._offsetX = 6;
     * Changes will be forgotten when the player goes to another map.
     *
     * Terms of use: free to use and/or modify for any project.
     */
    (alias => {
      Game_CharacterBase.prototype.screenX = function() {
        return alias.apply(this, arguments) + (this._offsetX || 0);
      };
    })(Game_CharacterBase.prototype.screenX);
    This adds a script call to apply a persistent offset until you leave the map. There are probably other plugins out there that offer something similar.

caethyril,​


That miniplugin works perfectly for events. Thank you. Exactly what I was looking for. I can mimic the slide with a couple wait commands. I've never really coded in the engine, what is the reference for the player event?

I've tried:

$gameMap.event(0)._offsetX = 6;
$gameMap.character._offsetX = 6;
$gameMap.player._offsetX = 6;

Can't find a reference for it.

EDIT: Nevermind got it:

$gamePlayer._offsetX = 6;

Thanks again!
Great! You can use $gamePlayer to reference the player map character, e.g.
JavaScript:
$gamePlayer._offsetX = 6;

Original thread: https://forums.rpgmakerweb.com/threads/character-pixel-shift-during-cutscene.141949/