[Script] [RPGMV] Script Hud_Map

kumuzukumuzu Posts: 669Registered
Hiện menu hub ngoài map:
// Window_HUD

// HUD窗口

function Window_HUD() {
    this.initialize.apply(this, arguments);
}

Window_HUD.prototype=Object.create(Window_Base.prototype);
Window_HUD.prototype.constructor = Window_HUD;
//初始化
Window_HUD.prototype.initialize=function(){ 

    var width = this.windowWidth();
    var height = this.windowHeight(); 
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this.opacity = 255;//预设背景透明度 
    this.actor=$gameActors.actor(1);
    this.old_hp = this.actor.hp;
    this.refresh();
    this.update();
};

//窗口宽
Window_HUD.prototype.windowWidth = function() {
    return 144+4+186+this.standardPadding()*2;
};
//窗口高
Window_HUD.prototype.windowHeight = function() {
    return 144+this.standardPadding()*2;
};

//刷新

Window_HUD.prototype.refresh = function() {
    this.contents.clear();
    this.drawActorFace(this.actor, 0, 0);
    this.drawActorName(this.actor,5,100);
    this.drawActorHp(this.actor,144+4,50);
};        

//更新数据
Window_HUD.prototype.update = function() {

    if(this.old_hp!=this.actor.hp){
    this.refresh();
    this.old_hp=this.actor.hp;
    }

Scene_Map.prototype.createHUDWindow = function() {
     this.hud = new Window_HUD();
     this.addWindow(this.hud);
};
Sign In or Register to comment.