Hello! I making a perfectly top down game (like gta 1/2) and my character sprite is bigger than the tile size (in this case 32x). Because of this, the character isn't center, but a bit pushed up. Although ! helps, its still not centered! Where in the rmmz_sprites effects this? thank you!
Draw character sprites from center? [MZ]
RPG Maker MZ SupportWould be helpful if you could show a screenshot, but in any case the shiftY is in rmmz_objects.js:
Having an exclamation mark should already align the sprite perfectly to the bottom border of the tile. If it's still not centered, could it be that your tile and your sprite aren't the same size (i.e. 32px)?
JavaScript:
Game_CharacterBase.prototype.shiftY = function() {
return this.isObjectCharacter() ? 0 : 6;
};
Having an exclamation mark should already align the sprite perfectly to the bottom border of the tile. If it's still not centered, could it be that your tile and your sprite aren't the same size (i.e. 32px)?
If you have a small character that you want to appear higher, you can just add space in the character sheet.
If you want a character to appear lower than the base of the tile they are in, that will need a plugin, e.g. (untested):
Otherwise, like @werzque says, a screenshot may help.
[Edit: added Y-position adjustment from later post.]
If you want a character to appear lower than the base of the tile they are in, that will need a plugin, e.g. (untested):
JavaScript:
/*:
* @target MZ
* @plugindesc Change character anchors from (0.5, 1) to (0.5, 0.5).
* @author Caethyril
* @url https://forums.rpgmakerweb.com/threads/159077/
* @help Free to use and/or modify for any project, no credit required.
*/
// Update anchor for standard display.
void (alias => {
Sprite_Character.prototype.initMembers = function() {
alias.apply(this, arguments);
this.anchor.y = 0.5;
};
})(Sprite_Character.prototype.initMembers);
// Update anchor for bush effect.
void (alias => {
Sprite_Character.prototype.createHalfBodySprites = function() {
alias.apply(this, arguments);
this._upperBody.anchor.y = 0.5;
this._lowerBody.anchor.y = 0.5;
};
})(Sprite_Character.prototype.createHalfBodySprites);
// Offset character positions up by half a tile.
void (alias => {
Game_CharacterBase.prototype.screenY = function() {
return alias.apply(this, arguments) - $gameMap.tileHeight() / 2;
};
})(Game_CharacterBase.prototype.screenY);
[Edit: added Y-position adjustment from later post.]
Heres a screenshot! the character is 38x38, tiles are 32x32. Id like the character to be vertically aligned with the stairs.
Thanks again for the help!
tried the pluggin and it moved me like a whole tile down.
Thanks again for the help!
Ah! I think the character screen position just needs adjusting, since usually that's used for the bottom-centre of the sprite. Try adding this to the plugin's code:
JavaScript:
// Offset character positions up by half a tile.
void (alias => {
Game_CharacterBase.prototype.screenY = function() {
return alias.apply(this, arguments) - $gameMap.tileHeight() / 2;
};
})(Game_CharacterBase.prototype.screenY);
Friggen perfect! Thank you guys!
Great, you're welcome! 👋
Original thread: https://forums.rpgmakerweb.com/threads/draw-character-sprites-from-center-mz.159077/