Esempio n. 1
0
func updateGroundImage(ground *ebiten.Image) error {
	if err := ground.Clear(); err != nil {
		return err
	}
	x16, y16 := theViewport.Position()
	op := &ebiten.DrawImageOptions{}
	op.GeoM.Translate(float64(-x16)/16, float64(-y16)/16)
	if err := ground.DrawImage(repeatedBgImage, op); err != nil {
		return err
	}
	return nil
}
Esempio n. 2
0
func updateGroundImage(ground *ebiten.Image) error {
	if err := ground.Clear(); err != nil {
		return err
	}
	x16, y16 := thePlayer.Position()
	a := thePlayer.Angle()
	gw, gh := ground.Size()
	w, h := gophersImage.Size()
	op := &ebiten.DrawImageOptions{}
	op.GeoM.Translate(float64(-x16)/16, float64(-y16)/16)
	op.GeoM.Translate(float64(-w*2), float64(-h*2))
	op.GeoM.Rotate(float64(-a)*2*math.Pi/maxAngle + math.Pi*3.0/2.0)
	op.GeoM.Translate(float64(gw)/2, float64(gh)-32)
	if err := ground.DrawImage(repeatedGophersImage, op); err != nil {
		return err
	}
	return nil
}