Код:
//=============================================================================
// LevelsBoss.js
//=============================================================================
/*:
* @plugindesc xfgdfg
* @author Alexandr_7
* @param enableSwitchId
* @desc Показать/Скрыть (номер переключателя)
* @default 2
*/
(function()
{
var Face_Player_Width = 100;
var Face_Player_Height = 100;
var Window_Player_Width = 292;
var Window_Player_Height = 120;
var parameters = PluginManager.parameters('LevelsBoss');
var enableSwitchId = Number(parameters['enableSwitchId']);
var _Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function()
{
_Scene_Map_createAllWindows.call(this);
this.face_hud = new FACE_hud();
this.addChild(this.face_hud);
this._levelsBoss_Player = new LevelsBossPlayer(5, 5, Window_Player_Width, Window_Player_Height);
//this._levelsBossEnemies = new LevelsBossEnemies(Graphics.boxWidth - 298,10, 392, 120);
this.addWindow(this._levelsBoss_Player);
//this.addWindow(this._levelsBossEnemies);
};
/*
*******************
Окно для игрока
*******************
*/
function LevelsBossPlayer() {
this.initialize.apply(this, arguments);
};
LevelsBossPlayer.prototype = Object.create(Window_Base.prototype);
LevelsBossPlayer.prototype.constructor = LevelsBossPlayer;
LevelsBossPlayer.prototype.standardPadding = function() {
return 0;
};
LevelsBossPlayer.prototype.initialize = function(x, y, width, height) {
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.update();
};
LevelsBossPlayer.prototype.update = function() {
this.contents.clear();
if ($gameSwitches.value(enableSwitchId) == true) {
this.show();
this.resetTextColor();
this.drawTextEx("fdgdfgd", 10 + Face_Player_Width + 5, 15);
} else {
this.hide();
}
};
/*
*******************
FACE hud
*******************
*/
function FACE_hud() {
this.initialize.apply(this, arguments);
};
FACE_hud.prototype = Object.create(Sprite.prototype);
FACE_hud.prototype.constructor = FACE_hud;
FACE_hud.prototype.initialize = function () {
Sprite.prototype.initialize.call(this);
this.x = 10;
this.y = 10;
this.bitmap = new Bitmap(Face_Player_Width, Face_Player_Height);
this.update();
};
FACE_hud.prototype.update = function() {
if ($gameSwitches.value(enableSwitchId) == true) {
this.drawIcon($gameParty.members()[0].faceName(),$gameParty.members()[0].faceIndex(), 5, 15, Face_Player_Width, Face_Player_Height);
}
};
FACE_hud.prototype.drawIcon = function(faceName,index, x, y, w, h) {
if (!this.bitmap) return false;
var bitmap = ImageManager.loadFace(faceName);
var pw = Window_Base._faceWidth;
var ph = Window_Base._faceHeight;
var sx = index%4*pw;
var sy = Math.floor(index/4)*pw;
this.bitmap.blt(bitmap,sx,sy,pw,ph,x,y, w, h);
return true;
}
})();
Мне интересно можно ли вывести фейс игрока не создавая при этом нового объекта и функции обновления этого объекта тобишь делать отрисовку прям в LevelsBossPlayer
Социальные закладки