//メインキャラへのダメージ
if(this.damaging){
if(this.damagePerTickCount == this.damagePerTickBase){
- this.ownerStage.manager.userManager.damage(this.touchDamage);
+ main.damage(this.touchDamage);
this.damagePerTickCount--;
} else{
this.damagePerTickCount--;
},
draw: function(x, y){
EnemyCharacterClass.base.prototype.draw.apply(this, arguments);
- this.ownerStage.mainContext.save();
- this.ownerStage.mainContext.fillStyle = "rgba(255,255,255,0.5)";
- this.ownerStage.mainContext.strokeStyle = "rgba(0, 0, 0, 1)";
- this.ownerStage.mainContext.font = "normal 12px sans-serif";
- drawText(this.ownerStage.mainContext, this.HP, x, y - 20);
- this.ownerStage.mainContext.restore();
+ if(this.hurt > 0)
+ {
+ this.ownerStage.mainContext.save();
+ var backColor = "gray";
+ var thickness = 4;
+ var barWidth = this.max_HP;
+ if(barWidth < 16) barWidth = 16;
+ var barPerHP = this.HP / this.max_HP;
+ var color = "green";
+
+ if(barPerHP < 0.2)
+ {
+ var backColor = "red";
+ }else if(barPerHP < 0.4)
+ {
+ var backColor = "yellow";
+ }
+
+ this.ownerStage.mainContext.fillStyle = backColor;
+ this.ownerStage.mainContext.fillRect(x + (this.size.x - barWidth) / 2, y - thickness, barWidth, thickness);
+ this.ownerStage.mainContext.fillStyle = color;
+ this.ownerStage.mainContext.fillRect(x + (this.size.x - barWidth) / 2, y - thickness, barWidth * barPerHP, thickness);
+
+ this.ownerStage.mainContext.restore();
+ }
},
});