mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/airship: Bug fix: stop if z value equals to or is less than 0
This commit is contained in:
parent
6213ee66f7
commit
762fcfc2db
@ -198,6 +198,9 @@ func drawGroundImage(screen *ebiten.Image, ground *ebiten.Image) {
|
|||||||
// z is in [1, -1]
|
// z is in [1, -1]
|
||||||
rate := float64(j) / float64(ph)
|
rate := float64(j) / float64(ph)
|
||||||
z := (1-rate)*1 + rate*-1
|
z := (1-rate)*1 + rate*-1
|
||||||
|
if z <= 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Translate(-float64(pw)/2, 0)
|
op.GeoM.Translate(-float64(pw)/2, 0)
|
||||||
op.GeoM.Scale(1/z, 8) // 8 is an arbitrary number not to make empty lines.
|
op.GeoM.Scale(1/z, 8) // 8 is an arbitrary number not to make empty lines.
|
||||||
|
Loading…
Reference in New Issue
Block a user