Files

53 lines
1.4 KiB
ActionScript

package com.arc.dh.state
{
import com.arc.dh.util.Data;
import com.arc.flixel.ArcSprite;
import org.flixel.FlxSprite;
public class HeartMeter extends ArcSprite
{
public static const heartFull:Class = HeartMeter_heartFull;
public static const heartEmpty:Class = HeartMeter_heartEmpty;
private var empty:FlxSprite;
private var full:FlxSprite;
public function HeartMeter(param1:Number, param2:Number)
{
super(param1,param2);
width = 9;
height = 9;
this.empty = new FlxSprite(0,y,heartEmpty);
this.empty.scrollFactor.x = this.empty.scrollFactor.y = 0;
this.full = new FlxSprite(0,y,heartFull);
this.full.scrollFactor.x = this.full.scrollFactor.y = 0;
}
override public function draw() : void
{
var _loc1_:int = 0;
_loc1_ = 0;
while(_loc1_ < Data.hpm)
{
if(_loc1_ < Data.hp)
{
this.full.x = x + _loc1_ % 10 * width;
this.full.y = y + int(_loc1_ / 10) * height;
this.full.draw();
}
else
{
this.empty.x = x + _loc1_ % 10 * width;
this.empty.y = y + int(_loc1_ / 10) * height;
this.empty.draw();
}
_loc1_++;
}
}
}
}