I am trying to create my own weakness plugin. I want to be able to put the icons showing the elemental and state weaknesses on the enemies. But I can't seem to "draw" the icon. Please help me out.
Here is what I have so far:
EDIT: Maybe I should create the icon in a window instead? Or create a Sprite class?
Here is what I have so far:
// JavaScript source code
//var bitmap = new Bitmap(32, 32);
//bitmap = loadBitmap(/img/system/, IconSet, 0, true);
var myBattleStart = BattleManager.startBattle;
BattleManager.startBattle = function () {
myBattleStart.call(this);
//this.MyDrawIcon(1, 0, 0);
this.addX = 0;
this.addY = 0;
for (var i = 0; i < $gameTroop._enemies.length; i++) {
console.log(1);
for (var v = 0; v < Game_BattlerBase.TRAIT_ATTACK_ELEMENT; v++) {
console.log(2)
if ($gameTroop._enemies[i].elementRate(v) > 1) {
console.log($gameTroop._enemies[i].elementRate(v));
this.bitmap = new Bitmap(16, 16);
//this.bitmap = MyDrawIcon(62 + v, 0, 0, 0, this.addY);
//this.sprite_enemy = new Sprite_Enemy($gameTroop._enemies[i]);
this.sprite_icon = new Sprite();
SceneManager._scene.addChild(this.sprite_icon);
MyDrawIcon(62 + v, 0, 0, 0, this.addY, this.sprite_icon);
this.sprite_icon.x += this.addX;
this.addX += 32;
console.log(this.sprite_icon.x);
//this.addY += 5;
}
}
}
}
MyDrawIcon = function (iconIndex, x, y, addPosX, addPosY, spriteID) {
var sprite = spriteID;
var bitmap = ImageManager.loadSystem('IconSet');
var pw = Window_Base._iconWidth;
var ph = Window_Base._iconHeight;
var sx = iconIndex % 16 * pw;
var sy = Math.floor(iconIndex / 16) * ph;
sprite.bitmap.blt(bitmap, sx, sy, pw, ph, x + addPosX, y + addPosY);
//spriteID = bitmap;
return bitmap;
};
EDIT: Maybe I should create the icon in a window instead? Or create a Sprite class?