fixed initial position bug
This commit is contained in:
parent
7e3404095a
commit
7997b15c26
8
main.go
8
main.go
@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"bitbucket.org/hackerbots/botserv/protocol"
|
||||
v "bitbucket.org/hackerbots/vector"
|
||||
"code.google.com/p/go.net/websocket"
|
||||
"flag"
|
||||
"fmt"
|
||||
@ -105,21 +104,16 @@ func addPlayer(ws *websocket.Conn) {
|
||||
}
|
||||
log.Printf("%s eventually sent valid config: %+v", id, conf)
|
||||
|
||||
start_pos := v.Point2d{
|
||||
X: rand.Float64() * *width,
|
||||
Y: rand.Float64() * *height,
|
||||
}
|
||||
p := &player{
|
||||
Robot: robot{
|
||||
Stats: conf.Stats,
|
||||
Position: start_pos,
|
||||
MoveTo: start_pos,
|
||||
Id: id,
|
||||
Health: conf.Stats.Hp,
|
||||
Scanners: make([]scanner, 0)},
|
||||
send: make(chan *boardstate),
|
||||
ws: ws,
|
||||
}
|
||||
p.reset()
|
||||
g.register <- p
|
||||
defer func() {
|
||||
g.unregister <- p
|
||||
|
Loading…
Reference in New Issue
Block a user