Hi, I'm working on a plugin. The idea is to show an enemy picture in the little window on the top left part of the screen.
I tried using "$gameScreen.showPicture(1, enemyInfoData[ind].name, 0, 130, 40, 100, 100, 255, 0);"
where "enemyInfoData[ind].name" stores enemy's name, corresponding to the file name of the picture in "img/pictures/...". It worked but the picture was shown below the window and not on the foreground of it, so I decided to give a try to sprites.
The code I'm using to print a sprite rather than a picture is the following, but I get the error: "Cannot read property 'addChild' of undefined". Anyway from the command window "this._image1" seems not to be undefined. What am I doing wrong?
PS. I have no need to use sprite at all, it would be ok, for me, to just print a picture if any of you know how to plot it over the window and not on the background. But accordly to what I have read in other threads it seems to be impossible since pictures are plotted just over the map. Is it correct?
Thanks.
I tried using "$gameScreen.showPicture(1, enemyInfoData[ind].name, 0, 130, 40, 100, 100, 255, 0);"
where "enemyInfoData[ind].name" stores enemy's name, corresponding to the file name of the picture in "img/pictures/...". It worked but the picture was shown below the window and not on the foreground of it, so I decided to give a try to sprites.
The code I'm using to print a sprite rather than a picture is the following, but I get the error: "Cannot read property 'addChild' of undefined". Anyway from the command window "this._image1" seems not to be undefined. What am I doing wrong?
JavaScript:
Scene_Battle.prototype.refreshImage = function (pictureName) {
// create new Sprite
this._image1 = new Sprite();
this._image1._bitmap = ImageManager.loadPicture(pictureName.name);
// add new Sprite as a child to the window's background
this.addChild(this._image1);
console.log("pictureName.name");
console.log(pictureName.name);
console.log("this._image1");
console.log(this._image1);
this.contents.addChild(this._image1); // this is the error row
};
Scene_Battle.prototype.createBattleEnemyPictureWindow = function (pictureName) {
this._BattleEnemyPictureWindow = new Window_Base(new Rectangle(0, 0, 100, 100)); // Riduciamo la larghezza della finestra
this._BattleEnemyPictureWindow.x = 100;
this._BattleEnemyPictureWindow.y = 0;
this.addWindow(this._BattleEnemyPictureWindow);
this.refreshImage(pictureName);
};
PS. I have no need to use sprite at all, it would be ok, for me, to just print a picture if any of you know how to plot it over the window and not on the background. But accordly to what I have read in other threads it seems to be impossible since pictures are plotted just over the map. Is it correct?
Thanks.