examples/airship: Better perspective

This commit is contained in:
Hajime Hoshi 2016-07-17 07:10:52 +09:00
parent 6541654746
commit 0933292d30

View File

@ -150,10 +150,12 @@ func (g *groundParts) Src(i int) (int, int, int, int) {
func (g *groundParts) Dst(i int) (int, int, int, int) {
w, _ := g.image.Size()
r := 30 + i*2
// TODO: If the last value is i + 1, there would be unexpected spots on the screen.
// i + 1 should work.
return -r, i, w + r, i + 2
r := 20 + i*16
j := 0.0
for idx := 0; idx < i; idx++ {
j += float64(idx) / 8
}
return -r, int(j), w + r, int(float64(j)+float64(i)/8) + 1
}
func drawGroundImage(screen *ebiten.Image, ground *ebiten.Image) error {