package ru.vagrant_ai.questionmarkgame.obj.particle;
import java.util.Random;
import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import ru.vagrant_ai.questionmarkgame.main.GameplayState;
import ru.vagrant_ai.questionmarkgame.util.Text;
import ru.vagrant_ai.questionmarkgame.util.list.PT;
public class HPParticle extends Particle {
private short x;
private short y;
private PT util_arg0; //hpup or hpdown
private short util_arg1; //main number
private short util_arg2; //for countdown
public HPParticle(PT type, int hp)
{
id = PT.HPDOWN;
x = (short) (GameplayState.player.getX()+(new Random().nextInt(30)-15));
y = (short) (GameplayState.player.getY()-20);
util_arg0 = type;
util_arg1 = (short) hp;
util_arg2 = 255;
}
public void update()
{
y--;
util_arg2 -= 8;
if (util_arg2 < 1) alive = false;
}
public void render(Graphics g)
{
Text.drawString(35, (int)x, (int)y, ""+((util_arg0 == PT.HPUP)?"+":"-")+util_arg1, new Color(((util_arg0 == PT.HPUP)?0:255),((util_arg0 == PT.HPUP)?255:0),0,util_arg2));
}
}