Hi,
I am trying to use Bitmap blt to layer some images together. Specifically I'm doing this in Sprite_Character.setCharacterBitmap so that I can create some layered character graphics.
It's not working however; the bitmap loads the skin image successfully, but doesn't get any further than that. If I put a missing file in I do get an error saying that image can't be found, so it's trying to load the images, it just isn't doing what I want it to do, which is to just layer them one on top of the other.
Here's my plugin code:
Does anyone know where I've gone wrong in the above?
I am trying to use Bitmap blt to layer some images together. Specifically I'm doing this in Sprite_Character.setCharacterBitmap so that I can create some layered character graphics.
It's not working however; the bitmap loads the skin image successfully, but doesn't get any further than that. If I put a missing file in I do get an error saying that image can't be found, so it's trying to load the images, it just isn't doing what I want it to do, which is to just layer them one on top of the other.
Here's my plugin code:
JavaScript:
Sprite_Character.prototype.setCharacterBitmap = function () {
// If image name contains "PPD" this is a paperdoll image
if (this._characterName.includes("PPD")) {
// split numbers into array
// image name looks like: %Base-PPD-1-2-3-4-5-6-7
// %Base is just from QSprite so we ignore that bit
bits = this._characterName.split('-');
skin = bits[2];
hair = bits[3];
body = bits[4];
legs = bits[5];
feet = bits[6];
weapon = bits[7];
shield = bits[8];
// load each piece as a bitmap
skin_bmp = ImageManager.loadCharacter('skin' + skin);
hair_bmp = ImageManager.loadCharacter('hair' + hair);
body_bmp = ImageManager.loadCharacter('top' + body);
legs_bmp = ImageManager.loadCharacter('legs' + legs);
feet_bmp = ImageManager.loadCharacter('feet' + feet);
weapon_bmp = ImageManager.loadCharacter('weapon' + weapon);
shield_bmp = ImageManager.loadCharacter('shield' + shield);
// layer each bitmap on top of the skin bitmap to create an image
skin_bmp.blt(hair_bmp, 0, 0, 3072, 3072, 0, 0);
skin_bmp.blt(body_bmp, 0, 0, 3072, 3072, 0, 0);
skin_bmp.blt(legs_bmp, 0, 0, 3072, 3072, 0, 0);
skin_bmp.blt(feet_bmp, 0, 0, 3072, 3072, 0, 0);
skin_bmp.blt(weapon_bmp, 0, 0, 3072, 3072, 0, 0);
skin_bmp.blt(shield_bmp, 0, 0, 3072, 3072, 0, 0);
// set bitmap
this.bitmap = skin_bmp;
} else {
// otherwise, do what the function originally did
this.bitmap = ImageManager.loadCharacter(this._characterName);
}
this._isBigCharacter = ImageManager.isBigCharacter(this._characterName);
};


