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