fixed resetart error vis-a-vis obstacles
This commit is contained in:
parent
cacb8b547d
commit
4eb849a63f
4
game.go
4
game.go
@ -51,6 +51,7 @@ type game struct {
|
|||||||
projectiles map[*Projectile]bool
|
projectiles map[*Projectile]bool
|
||||||
splosions map[*Splosion]bool
|
splosions map[*Splosion]bool
|
||||||
obstacles []Obstacle
|
obstacles []Obstacle
|
||||||
|
obstacle_count int
|
||||||
register chan *player
|
register chan *player
|
||||||
unregister chan *player
|
unregister chan *player
|
||||||
turn int
|
turn int
|
||||||
@ -74,6 +75,7 @@ func NewGame(id string, width, height float32, obstacles, tick int) *game {
|
|||||||
projectiles: make(map[*Projectile]bool),
|
projectiles: make(map[*Projectile]bool),
|
||||||
splosions: make(map[*Splosion]bool),
|
splosions: make(map[*Splosion]bool),
|
||||||
obstacles: GenerateObstacles(obstacles, width, height),
|
obstacles: GenerateObstacles(obstacles, width, height),
|
||||||
|
obstacle_count: obstacles,
|
||||||
players: make(map[*player]bool),
|
players: make(map[*player]bool),
|
||||||
turn: 0,
|
turn: 0,
|
||||||
width: width,
|
width: width,
|
||||||
@ -307,7 +309,7 @@ func (g *game) gameOver() (bool, *GameOver) {
|
|||||||
var stats *GameOver
|
var stats *GameOver
|
||||||
|
|
||||||
if g.players_remaining <= 1 && len(g.players) > 1 {
|
if g.players_remaining <= 1 && len(g.players) > 1 {
|
||||||
g.obstacles = GenerateObstacles(conf.Obstacles, g.width, g.height)
|
g.obstacles = GenerateObstacles(g.obstacle_count, g.width, g.height)
|
||||||
log.Printf("game %s: game over", g.id)
|
log.Printf("game %s: game over", g.id)
|
||||||
stats = NewGameOver()
|
stats = NewGameOver()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user