gvsu/cs654/final-proj/Player.java
josh 7795f9bc1c imported from remote update
git-svn-id: svn://anubis/gvsu@97 45c1a28c-8058-47b2-ae61-ca45b979098e
2008-04-13 17:27:05 +00:00

42 lines
1.1 KiB
Java

public class Player extends GameItem
{
public static final double DEFAULT_RADIUS = 0.06;
public static final double COLLIDE_DAMAGE = 0.002;
public static final double SHOT_DELAY = 4.0;
public String name;
public double health;
public double r;
public double dr;
public long lastShotTime;
public Player(String name)
{
this.name = name;
this.radius = DEFAULT_RADIUS;
this.health = 1.0;
this.r = Math.random() * Math.PI * 2;
this.dr = 0;
this.dx = 0;
this.dy = 0;
}
public boolean equals(Player other)
{
return this.name.equals(other.name) &&
this.radius == other.radius &&
this.health == other.health &&
this.r == other.r &&
this.dr == other.dr &&
this.dx == other.dx &&
this.dy == other.dy;
}
public String toString()
{
return String.format("%s:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f:%.3f",
name, radius, health, x, y, r, dr, dx, dy);
}
}