projectiles should have their own ID

This commit is contained in:
Fraser Graham 2013-11-06 20:32:56 -08:00
parent bad900997f
commit 545b68d1d7
2 changed files with 3 additions and 3 deletions

View File

@ -215,7 +215,7 @@ func (p *player) fire(projectiles map[*Projectile]bool, turn int) *Projectile {
p.Robot.LastFired = turn
return &Projectile{
Id: p.Robot.Id,
Id: idg.Hash(),
Position: p.Robot.Position,
MoveTo: *p.Robot.FireAt,
Damage: 10,

View File

@ -8,7 +8,7 @@ type Projectile struct {
Id string `json:"id"`
Position v.Point2d `json:"position"`
MoveTo v.Point2d `json:"-"`
Radius int `json:"radius"`
Radius int `json:"-"`
Speed float32 `json:"-"`
Damage int `json:"-"`
Owner *player `json:"-"`
@ -22,7 +22,7 @@ func (p *Projectile) Tick(g *game) {
hit_player := false
for player := range g.players {
if player.Robot.Id == p.Id {
if player == p.Owner {
continue
}
dist := v.Distance(player.Robot.Position, p.Position)