예제 #1
0
func NewSheepleNode(t lib.Torus) *lib.SimNode {
	sh := &Sheeple{}
	sh.D = lib.Vec2(1.0, 0)
	sh.S = 1.0
	n := lib.EmptyNode()
	n.Entity = sh
	n.Name = "sheeple"
	n.P = randPlace(t)
	sh.LastP = lib.Vec2(0, 0)
	sh.wander(n, t)
	sh.wander(n, t)
	return n
}
예제 #2
0
func randPlace(t lib.Torus) *m.Vector {
	x := tmap(rand.Float64(), t.W)
	y := tmap(rand.Float64(), t.H)
	return lib.Vec2(x, y)
}