mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
examples/airship: Better perspective
This commit is contained in:
parent
6541654746
commit
0933292d30
@ -150,10 +150,12 @@ func (g *groundParts) Src(i int) (int, int, int, int) {
|
|||||||
|
|
||||||
func (g *groundParts) Dst(i int) (int, int, int, int) {
|
func (g *groundParts) Dst(i int) (int, int, int, int) {
|
||||||
w, _ := g.image.Size()
|
w, _ := g.image.Size()
|
||||||
r := 30 + i*2
|
r := 20 + i*16
|
||||||
// TODO: If the last value is i + 1, there would be unexpected spots on the screen.
|
j := 0.0
|
||||||
// i + 1 should work.
|
for idx := 0; idx < i; idx++ {
|
||||||
return -r, i, w + r, i + 2
|
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 {
|
func drawGroundImage(screen *ebiten.Image, ground *ebiten.Image) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user