Example #1
0
// update adjusts the minimap according to the players new position.
func (mm *minimap) update(v vu.View, sentries []*sentinel) {
	scale := mm.scale
	x, y, z := v.Cam().Location()
	x, y, z = x*scale, y*scale, z*scale
	mm.cam.SetLocation(x, y, z)
	mm.setPlayerLocation(x, y, z)
	mm.setPlayerRotation(v.Cam().Lookxz())
	mm.setCenterLocation(x, y, z)
	mm.setSentryLocations(sentries)
}
Example #2
0
// setLevel is called when a level transition happens.
func (mm *minimap) setLevel(v vu.View, lvl *level) {
	x, y, z := v.Cam().Location()
	mm.cam.SetLocation(x*mm.scale, y*mm.scale, z*mm.scale)

	// adjust the center location based on the game maze center.
	mm.cx, mm.cy = float64(lvl.gcx*lvl.units)*mm.scale, float64(-lvl.gcy*lvl.units)*mm.scale
	mm.ppm.SetLocation(x, y, z)
	mm.bg.SetLocation(x, y, z)
	mm.ppm.SetRotation(v.Cam().Lookxz())
	mm.setSentryLocations(lvl.sentries)
	lvl.player.monitorHealth("mmap", mm)
}