Script - HUD HP e MP

5 Respostas   450 Visualizações

0 Membros e 1 Visitante estão vendo este tópico.

kholyphoenix1

  • *
  • Posts: 175
  • Ouros: 11
  • Só o Senhor é Deus!
Tópico criado em: 07/01/2016 às 10:24 - Última modificação por Skyloftian em 08/01/2016 às 20:13

Bom dia,

Alguém poderia me arrumar ou ajuda a criar um HUD de HP e MP por script?
Onde não haveria necessidade de utilizar imagens claro se possível.

Obrigado desde já!
JeSuS está voltando! Volte para ele antes!

Lima

Resposta 1: 07/01/2016 às 13:43

Para que engine?

kholyphoenix1

  • *
  • Posts: 175
  • Ouros: 11
  • Só o Senhor é Deus!
Resposta 2: 08/01/2016 às 09:31 - Última modificação por kholyphoenix1 em 08/01/2016 às 10:30

Estou precisando para o MV.
Estava tentando fazer as HUD utilizando var mais é muito chato kkkk²
JeSuS está voltando! Volte para ele antes!

Lima

Resposta 3: 08/01/2016 às 18:05

Estou precisando para o MV.
Estava tentando fazer as HUD utilizando var mais é muito chato kkkk²

Tem alguma preferência na disposição da hud?

kholyphoenix1

  • *
  • Posts: 175
  • Ouros: 11
  • Só o Senhor é Deus!
Resposta 4: 08/01/2016 às 19:39

Pode deixar está resolvido.
Oh muito obrigado!!! :ok:

Abraço!!
JeSuS está voltando! Volte para ele antes!

Lima

Resposta 5: 08/01/2016 às 19:43

Eu estive a criar essa:

Código: [Selecionar]
//-----------------------------------------------------------------------------
// Window_Hud
//
// The window for displaying the party's gold.

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(x, y) {
    var width = this.windowWidth();
    var height = this.windowHeight();
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this.refresh();
};



Window_Hud.prototype.Hp = function() {
width = SceneManager._screenWidth * 0.25;
x=0;
y=50;
    var actor = $gameParty.members()[0];
var color1 = this.hpGaugeColor1();
    var color2 = this.hpGaugeColor2();

    this.drawGauge(x, 0, width, actor.hpRate(), this.textColor(10), this.textColor(2));
    this.changeTextColor(this.systemColor());
    this.drawText(TextManager.hpA, x, 0, 44);
    this.drawCurrentAndMax(actor.hp, actor.mhp, x, 0, width,
                           this.hpColor(actor), this.normalColor());
   
   
    this.drawGauge(x, y, width, actor.mpRate(), color1, color2);
    this.changeTextColor(this.systemColor());
    this.drawText(TextManager.mpA, x, y, 100);
    this.drawCurrentAndMax(actor.mp, actor.mmp, x, y, width,
                           this.mpColor(actor), this.normalColor());    
};


Window_Hud.prototype.windowWidth = function() {
    return SceneManager._screenWidth * 0.3;
};

Window_Hud.prototype.windowHeight = function() {
    return SceneManager._screenHeight * 0.2;
};

Window_Hud.prototype.refresh = function() {
    var x = this.textPadding();
    var width = this.contents.width - this.textPadding() * 2;
    this.contents.clear();
this.contents.drawText(this.Hp(), 0, 0, width, this.lineHeight(), 'left');

};


;

Window_Hud.prototype.open = function() {
    this.refresh();
    Window_Base.prototype.open.call(this);
};




var oldSceneMap_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
  oldSceneMap_start.call(this);
 
  this.createhudWindow();
}
 
Scene_Map.prototype.createhudWindow = function() {
  this._hudWindow = new Window_Hud();
  this._hudWindow.x = 0;
  this._hudWindow.y = 0;
  this.addChild(this._hudWindow);
};
 
var oldSceneMap_update = Scene_Map.prototype.update;
Scene_Map.prototype.update = function() {
  oldSceneMap_update.call(this);

  if (this._hudWindow !== undefined) {
    this._hudWindow.refresh();
  }
};