今回はdrawhpgaugeやdrawmpgaugeに関した質問です。
・作ろうとするもの
アクターが敵より10以上レベルが高くないと、敵の情報を見ることができなくするのが目的です。
戦闘は一対一で、アクターと敵のステータスは新しく作ったウィンドウで表示しております。
・現在の問題
drawhpgaugeとdrawmpgaugeにおいて、ifでレベルの差を条件に違う情報を表示しようとしましたけど、条件を無視して正常的にゲージが出力されます。
私がいじったdrawhpgaugeは
(読みずらいという話があったのでインデントしました。)
コード: 全て選択
//↓私が作ったウィンドウのクラスです。
Teki_Info.prototype.drawActorHp = function(actor, x, y, width) {
width = width || 186;
var color1 = this.hpGaugeColor1();
var color2 = this.hpGaugeColor2();
if ($gameActors.actor(1).level > $gameTroop.members()[0]._level+10) {
this.drawGauge(x, y, width, actor.hpRate(), color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.hpA, x, y, 44);
this.drawCurrentAndMax(actor.hp, actor.mhp, x, y, width,
this.hpColor(actor), this.normalColor());
} else {
//↓いつも満タンに見せるためrateを変更
this.drawGauge(x, y, width, 1, color1, color2);
this.changeTextColor(this.systemColor());
this.drawText(TextManager.hpA, x, y, 44);
//↓現在値と最大値を見えないように
this.drawCurrentAndMax("??", "??", x, y, width,
this.hpColor(actor), this.normalColor());
};
これをthis.frawActorHpで出力させますが、条件を無視して普通のゲージが出力されます。
drawgaugeと関連したすべての関数をTeki_Infoのクラスに作っておいたけどゲージ隠しに失敗したのは、Teki_InfoではなくWindow_Baseの関数を使うからでしょうか?
皆様のアドバイスをお待ちさせていただきます。質問を読んでいただいて誠にありがとうございます。