func MissileBox(gameMinX, gameMaxX, x, y, fieldTop, cannonBottom, cannonWidth, cannonHeight, missileWidth, missileHeight float64, up bool) Rect {
	minX := gameMinX + .5*cannonWidth - .5*missileWidth
	maxX := gameMaxX - .5*cannonWidth - .5*missileWidth
	fx := x*(maxX-minX) + minX
	var fy float64
	if up {
		minY := cannonBottom + cannonHeight
		maxY := fieldTop - missileHeight
		fy = y*(maxY-minY) + minY
	} else {
		minY := cannonBottom
		maxY := fieldTop - cannonHeight - missileHeight
		fy = y*(minY-maxY) + maxY
	}
	return Rect{
		X1: fx,
		Y1: fy,
		X2: fx + missileWidth,
		Y2: fy + missileHeight,
	}
}
MissileBox returns bounding box.
package unit
import (
	"image"
)
const (
	ScaleCannon = .2
	ScaleMissile = .15
	ScaleBrick = .08
)
type Rect struct {
	X1, Y1, X2, Y2 float64
}
func (r Rect) Bounding() (float64, float64, float64, float64) {
	return r.X1, r.Y1, r.X2, r.Y2
}
func CannonBox(gameMinX, gameMaxX, x, fieldTop, cannonBottom, cannonWidth, cannonHeight float64, up bool) Rect {
	cx := x*(gameMaxX-cannonWidth-gameMinX) + gameMinX
	var cy1, cy2 float64
	if up {
		cy1 = cannonBottom
		cy2 = cy1 + cannonHeight
	} else {
		cy2 = fieldTop
		cy1 = cy2 - cannonHeight
	}
	return Rect{
		X1: cx,
		Y1: cy1,
		X2: cx + cannonWidth,
		Y2: cy2,
	}
}