- Joined
- May 30, 2023
- Messages
- 440
- Reaction score
- 264
- First Language
- EN/JP/NL
- Primarily Uses
- RMMZ
This is something that started in a thread in RMMZ Support.
Characters with "isObjectCharacter" set to true will have a offset of 0 (shiftY is 0), as opposed to the default offset of -6 (shiftY is 6) for, errr, normal characters.
The question in the thread was to have a offset for a large car sprite, which would mean that the anchor would have to be more to the middle of the image. So I thought of just creating a "isCarCharacter" that is true when the filename starts with a "#". Downstream, I assign a shiftY of -42 when isCarCharacter is true. Upon testing, this plugin results in all characters to be offset as if isCarCharacter is true... and i can't figure out why this is... please help.
Characters with "isObjectCharacter" set to true will have a offset of 0 (shiftY is 0), as opposed to the default offset of -6 (shiftY is 6) for, errr, normal characters.
The question in the thread was to have a offset for a large car sprite, which would mean that the anchor would have to be more to the middle of the image. So I thought of just creating a "isCarCharacter" that is true when the filename starts with a "#". Downstream, I assign a shiftY of -42 when isCarCharacter is true. Upon testing, this plugin results in all characters to be offset as if isCarCharacter is true... and i can't figure out why this is... please help.
JavaScript:
(function() {
'use strict';
ImageManager.isCarCharacter = function(filename) {
const sign = Utils.extractFileName(filename).match(/^[#!$]+/);
return sign && sign[0].includes("#");
};
ImageManager.isObjectCharacter = function(filename) {
const sign = Utils.extractFileName(filename).match(/^[#!$]+/);
return sign && sign[0].includes("!");
};
ImageManager.isBigCharacter = function(filename) {
const sign = Utils.extractFileName(filename).match(/^[#!$]+/);
return sign && sign[0].includes("$");
};
Game_CharacterBase.prototype.shiftY = function() {
return this.isObjectCharacter() ? 0 : (this.isCarCharacter ? -42 : 6);
};
Game_CharacterBase.prototype.setImage = function(
characterName,
characterIndex
) {
this._tileId = 0;
this._characterName = characterName;
this._characterIndex = characterIndex;
this._isObjectCharacter = ImageManager.isObjectCharacter(characterName);
this._isCarCharacter = ImageManager.isCarCharacter(characterName);
};
Game_CharacterBase.prototype.isCarCharacter = function() {
return this._isCarCharacter;
};
})();
Last edited: