Frostorm

[]D[][]V[][]D aka "Staf00"
Veteran
Joined
Feb 22, 2016
Messages
1,846
Reaction score
1,603
First Language
English
Primarily Uses
RMMV
So I am using slightly larger character sprites that are 64x64 instead of the default 48x48. The sprite sheet is correctly named ("!" omitted) so that the monsters are shifted 6 pixels upwards. So it looks perfect on the map. The issue I have is during battle. The default code is meant for 48x48 sprites, and so I edited the following code to accommodate 64x64 sprites. Oh right, I forgot to mention that, out of the box, LeTBS_RTPUse.js does NOT offset the sprites upwards 6 pixels. Therein lies my problem...

Here's the relevant code in spoilers:
JavaScript:
TBSEntity_Sprite.prototype.createCharaBitmap = function (fbitmap, array, pose) {
    var battler = this._entity.battler();
    var charaIndex = battler.isActor() ? battler.characterIndex() : Number(array[2].trim());
    var lineIndex = array[3] ? Number(array[3].trim()) : undefined;
    var frameIndex = array[4] ? Number(array[4].trim()) : undefined;
    var bitmap = new Bitmap(48 * 3, 48 * 4);
    var pw = fbitmap.width / 4;
    var ph = fbitmap.height / 2;
    var n = charaIndex;
    var sx = (n % 4) * pw;
    var sy = Math.floor(n / 4) * ph;
    bitmap.blt(fbitmap, sx, sy, pw, ph, 0, 0);
    if (lineIndex >= 0) {
        ph /= 4;
        sy = lineIndex * ph;
        if (frameIndex >= 0) {
            pw /= 3;
            sx = frameIndex * pw;
            var newBmp = new Bitmap(48, 48);
            newBmp.blt(bitmap, sx, sy, pw, ph, 0, 0);
            this._bitmaps[pose] = newBmp;
            this._maxFrame[pose] = 0;
            this._nbrLines[pose] = 1;
        } else {
            var newBmp = new Bitmap(48 * 3, 48);
            newBmp.blt(bitmap, 0, sy, pw, ph, 0, 0);
            this._bitmaps[pose] = newBmp;
            this._maxFrame[pose] = 2;
            this._nbrLines[pose] = 1;
        }
    } else {
        this._maxFrame[pose] = 2;
        this._nbrLines[pose] = 4;
        this._bitmaps[pose] = bitmap;
    }
    this._frameLoaded++;
};
JavaScript:
TBSEntity_Sprite.prototype.createCharaBitmap = function (fbitmap, array, pose) {
    var battler = this._entity.battler();
    var charaIndex = battler.isActor() ? battler.characterIndex() : Number(array[2].trim());
    var lineIndex = array[3] ? Number(array[3].trim()) : undefined;
    var frameIndex = array[4] ? Number(array[4].trim()) : undefined;
    var bitmap = new Bitmap(64 * 3, 64 * 4);
    var pw = fbitmap.width / 4;
    var ph = fbitmap.height / 2;
    var n = charaIndex;
    var sx = (n % 4) * pw;
    var sy = Math.floor(n / 4) * ph;
    bitmap.blt(fbitmap, sx, sy, pw, ph, 0, 0);
    if (lineIndex >= 0) {
        ph /= 4;
        sy = lineIndex * ph;
        if (frameIndex >= 0) {
            pw /= 3;
            sx = frameIndex * pw;
            var newBmp = new Bitmap(64, 64);
            newBmp.blt(bitmap, sx, sy, pw, ph, 0, 0);
            this._bitmaps[pose] = newBmp;
            this._maxFrame[pose] = 0;
            this._nbrLines[pose] = 1;
        } else {
            var newBmp = new Bitmap(64 * 3, 64);
            newBmp.blt(bitmap, 0, sy, pw, ph, 0, 0);
            this._bitmaps[pose] = newBmp;
            this._maxFrame[pose] = 2;
            this._nbrLines[pose] = 1;
        }
    } else {
        this._maxFrame[pose] = 2;
        this._nbrLines[pose] = 4;
        this._bitmaps[pose] = bitmap;
    }
    this._frameLoaded++;
};
Now, when I try to change bitmap.blt(fbitmap, sx, sy, pw, ph, 0, 0); to bitmap.blt(fbitmap, sx, sy, pw, ph, 0, -6);, the sprite does get shifted up, however 6 pixels of the sprite gets cut-off and reappears on the bottom! Here's a screenshot to illustrate what I mean: (notice the wings)
1611118087804.png

I've also tried messing with some of the other variables such as sy or ph to no avail... Is there something besides bitmap.blt(fbitmap, sx, sy, pw, ph, 0, 0); I should be looking at?
 
Last edited:

Latest Threads

Latest Profile Posts

KenKrath wrote on RPGMakerWeb's profile.
Nevermind.
I found a book about game localization. It costs R$708,00 on Amazon. ;_;
I really wish my game was far enough along for it to be actually playable beyond certain aspects. I think I've crafted a really fun battle system thanks to ATB, fighting game, and Boost point mechanics.
Play test of my current progress on Happy Camper
Cutscene Contest Winners have been announced!

Forum statistics

Threads
109,113
Messages
1,042,201
Members
141,612
Latest member
mhayes
Top