examples/airship/main.go
func (p *player) MoveForward() {
	w, h := gophersImage.Size()
	mx := w * 16
	my := h * 16
	s, c := math.Sincos(float64(p.angle) * 2 * math.Pi / maxAngle)
	p.x16 += int(round(16*c) * 2)
	p.y16 += int(round(16*s) * 2)
	for mx <= p.x16 {
		p.x16 -= mx
	}
	for my <= p.y16 {
		p.y16 -= my
	}
	for p.x16 < 0 {
		p.x16 += mx
	}
	for p.y16 < 0 {
		p.y16 += my
	}
}
func (p *player) MoveForward() {
	w, h := gophersImage.Size()
	mx := w * 16
	my := h * 16
	s, c := math.Sincos(float64(p.angle) * 2 * math.Pi / maxAngle)
	p.x16 += int(round(16*c) * 2)
	p.y16 += int(round(16*s) * 2)
	for mx <= p.x16 {
		p.x16 -= mx
	}
	for my <= p.y16 {
		p.y16 -= my
	}
	for p.x16 < 0 {
		p.x16 += mx
	}
	for p.y16 < 0 {
		p.y16 += my
	}
}
func ( p * player ) MoveForward ( ) { w , h := gophersImage . Size ( ) mx := w * 16 my := h * 16 s , c := math . Sincos ( float64 ( p . angle ) * 2 * math . Pi / maxAngle ) p . x16 += int ( round ( 16 * c ) * 2 ) p . y16 += int ( round ( 16 * s ) * 2 ) for mx <= p . x16 { p . x16 -= mx } for my <= p . y16 { p . y16 -= my } for p . x16 < 0 { p . x16 += mx } for p . y16 < 0 { p . y16 += my } }
// MoveForward moves the player p forward.
MoveForward moves the player p forward .