// if ship is near the black hole center, draw it smaller
	scale := 1.0
	if g.blackHoleX > 0 && g.blackHoleY > 0 {
		dx := g.playerLocation.X - g.blackHoleX
		dy := g.playerLocation.Y - g.blackHoleY
		distance := math.Sqrt(float64(dx*dx + dy*dy))
		if distance < 100 {
			scale = 0.1 + ((100 - distance) / 400) // 400 -> make this frame based to smooth it out. Why is ship getting smaller, then larger again ?
		}
	}

Share Code in Seconds

Don’t waste time copying files. Install Snippet Share and start sharing your code with one shortcut — quick, easy, seamless.