projectiles should have their own ID
This commit is contained in:
parent
bad900997f
commit
545b68d1d7
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user