need to have games track width/height

This commit is contained in:
Stephen McQuay 2013-09-01 22:04:34 -07:00
parent b800f77c24
commit 0396b16425

27
game.go
View File

@ -7,20 +7,21 @@ import (
) )
type game struct { type game struct {
players map[*player]bool players map[*player]bool
projectiles map[*projectile]bool projectiles map[*projectile]bool
splosions map[*splosion]bool splosions map[*splosion]bool
register chan *player register chan *player
unregister chan *player unregister chan *player
robot_id chan int robot_id chan int
turn int turn int
spectators map[*Spectator]bool width, height float64
sregister chan *Spectator spectators map[*Spectator]bool
sunregister chan *Spectator sregister chan *Spectator
kill chan bool sunregister chan *Spectator
kill chan bool
} }
func NewGame() *game { func NewGame(width, height float64) *game {
return &game{ return &game{
register: make(chan *player), register: make(chan *player),
unregister: make(chan *player), unregister: make(chan *player),
@ -28,6 +29,8 @@ func NewGame() *game {
splosions: make(map[*splosion]bool), splosions: make(map[*splosion]bool),
players: make(map[*player]bool), players: make(map[*player]bool),
turn: 0, turn: 0,
width: width,
height: height,
spectators: make(map[*Spectator]bool), spectators: make(map[*Spectator]bool),
sregister: make(chan *Spectator), sregister: make(chan *Spectator),
sunregister: make(chan *Spectator), sunregister: make(chan *Spectator),