Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
45,453
Reaction score
16,376
First Language
English
Primarily Uses
RMMV
Character Anchors
2019.02.13
by Shaz

Introduction
This plugin allows you to adjust the position of a character's sprite by changing the X and/or Y anchors.
This would allow you, for example, to have a sprite that is larger than 48x48 centered both vertically and horizontally on the tile, extending below the bottom of the tile. Or to have an event that starts an NPC dialogue, with the NPC sprite several tiles away.

How to Use
Add to your plugin folder (name doesn't matter, but call it Shaz_CharacterAnchors.js in case there's ever an update that adds parameters).
Enable the plugin via the plugin manager.
Add anchor tags to an event using the event note box or using comments.

Background
By default, event sprites are anchored by the center horizontally (anchorX = 0.5) and the bottom vertically (anchorY = 1).
The anchor point is "attached" to the bottom middle of the tile.
This plugin allows you to set a different anchor point for the sprite, but it will still be attached to the bottom middle of the tile, so you'll need to experiment a bit to get it lined up correctly.
For example, if you set the X and Y anchors both to 0, the top left corner of the sprite would be aligned to the bottom center of the tile, so it would appear on the row below the event's location, half way over into the next tile to the right

Examples
Use one or both tags as needed.

Using event notes:
Code:
<anchorX: 0.5><anchorY: 0.5>
Code:
<anchorX: 0.5>
Code:
<anchorY: 0.5>

Using comments:
Code:
Comment: <anchorX: 0.5><anchorY: 0.5>
Code:
Comment: <anchorX: 0.5>
         <anchorY: 0.5>
Code:
Comment: <anchorX: 0.5>
Comment: <anchorY: 0.5>

Script Calls
Where id is the event's id, with no leading zeros:
Code:
Script: $gameMap.event(id).setAnchorX(0.5)
Code:
Script: $gamePlayer.setAnchorX(0.5)
Code:
Script: $gamePlayer.followers()[0].setAnchorX(0.5)

Or inside a move route that's applied to the player or an event:
Code:
Script: this.setAnchorX(0.5)

Notes
n can be a whole number or a floating point number.
0, 0 is the top left of the sprite.
1, 1 is the bottom right of the sprite.
n can be less than 0, or greater than 1 - the sprite can be on a completely different tile if you use larger negative or positive numbers.

Plugin
Get it here!

Credit
- Shaz

Terms
- free for use in commercial games
- do not post elsewhere - link back to this page
 
Last edited:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
45,453
Reaction score
16,376
First Language
English
Primarily Uses
RMMV
Try changing the order of the plugins. If that doesn't work, you'll need to start a new thread in plugin support and see if someone can write you a compatibility patch.
 

dopan

Veteran
Veteran
Joined
Mar 27, 2020
Messages
1,297
Reaction score
690
First Language
German
Primarily Uses
RMMV
@Shaz
I recognized, when changing anchors and using "bushdeep", that will reset the char position to system default.

the bugfix which i would like to suggest,
is overwriting the function that sets the bush-anchors..

basicly just add this to the plugin if the fix is needed
JavaScript:
Sprite_Character.prototype.createHalfBodySprites = function() {
    if (!this._upperBody) {
        this._upperBody = new Sprite();
        this._upperBody.anchor.x = this._character.anchorX();//0.5;
        this._upperBody.anchor.y = this._character.anchorY();//1;
        this.addChild(this._upperBody);
    }
    if (!this._lowerBody) {
        this._lowerBody = new Sprite();
        this._lowerBody.anchor.x = this._character.anchorX();//0.5;
        this._lowerBody.anchor.y = this._character.anchorY();//1;
        this._lowerBody.opacity = 128;
        this.addChild(this._lowerBody);
    }
};

I tested it and it works fine
(i guess that way the "bushdeep"-anchors are always the same as the data from your plugin)

Edit (about Z anchor manipulation)

btw i just made a rpg mv plugin that does a similar thing for Chara Z anchor. But it only provides us with scriptcalls, no notes and no comments as trigger options..
"prioCharZ" can be found on my github and here:
 
Last edited:

Latest Threads

Latest Profile Posts

swordsman defense :to show not to use.
show.gif
4,4,4.gifloop24.gif4.4.4.end.gif
I bought SALMIAC.:kaoluv: Salmiac is HEAVEN. Black, salty, hypertensive heaven! My dad once ate so much salmiac his doctor tole him to STOP! :biggrin:

Still no spoons tho. :kaophew:
I am supposed to be preparing to teach my students this afternoon and tomorrow morning about Refugees, Asylees, and Fraud/Misrepresentation and all I can think about is how to improve my Turn Order display. :stickytongue:
Try changing POV battle, near and far away like suikoden...
watercave2.jpg

diablofar.jpg

In the end I choose near over shoulder resembles RE4. Tight close window better. The correlation between battleback, monster style and battler should also be observed and merged.
Upgraded my avatar to be cuter.

Forum statistics

Threads
129,705
Messages
1,204,481
Members
170,778
Latest member
RubySu4111
Top