From 762fcfc2dbdc5867646c9ed13a262bb18ebb9a9b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 12 Mar 2018 03:23:04 +0900 Subject: [PATCH] examples/airship: Bug fix: stop if z value equals to or is less than 0 --- examples/airship/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/airship/main.go b/examples/airship/main.go index 5f0e37f74..65c495c50 100644 --- a/examples/airship/main.go +++ b/examples/airship/main.go @@ -198,6 +198,9 @@ func drawGroundImage(screen *ebiten.Image, ground *ebiten.Image) { // z is in [1, -1] rate := float64(j) / float64(ph) z := (1-rate)*1 + rate*-1 + if z <= 0 { + break + } op := &ebiten.DrawImageOptions{} op.GeoM.Translate(-float64(pw)/2, 0) op.GeoM.Scale(1/z, 8) // 8 is an arbitrary number not to make empty lines.