Exemplo n.º 1
0
func NewRandSoldier(d *display.Display, name string) *Soldier {
	s := new(Soldier)
	s.Name = name
	s.Pt = complex(rand.Float64(), rand.Float64())
	s.P = d.NewParticle(real(s.Pt), imag(s.Pt), 1, RankColor)
	s.PastPt = s.Pt
	s.Adj = make([]*Soldier, 4)
	return s
}
Exemplo n.º 2
0
func NewSoldier(d *display.Display, name string, pt complex128, dir complex128) *Soldier {
	s := new(Soldier)
	s.Name = name
	s.P = d.NewParticle(real(pt), imag(pt), 1, RankColor)
	s.Pt = pt
	s.PastPt = pt
	s.Dir = dir
	s.Adj = make([]*Soldier, 4)
	return s
}
Exemplo n.º 3
0
func OrderKey(d *display.Display, ch chan generals.Order, o generals.Order, key string) {
	err := d.NewKeyBinding(func() { ch <- o }, key)
	if err != nil {
		log.Fatal(err)
	}
}