diff --git a/examples/splashmenu/scenes/parallax.go b/examples/splashmenu/scenes/parallax.go index fab5406..d9b5e00 100644 --- a/examples/splashmenu/scenes/parallax.go +++ b/examples/splashmenu/scenes/parallax.go @@ -175,6 +175,13 @@ func (p *Parallax) DrawDynamicBackground(screen *ebiten.Image) { xd := (x0-float64(x))/DEBRIS_SCALE_DIST*float64(k+1) + x0 - float64(p.increment*k)/FLOAT_SCALE yd := (y0-float64(y))/DEBRIS_SCALE_DIST*float64(k+1) + y0 - float64(p.increment*k)/FLOAT_SCALE + adjustX := float64(p.Dimensions.Width) + adjustY := float64(p.Dimensions.Height) + intX := adjustX * math.Floor(float64(p.increment)/adjustX) + intY := adjustY * math.Floor(float64(p.increment)/adjustY) + xd = xd + intX + yd = yd + intY + op = &ebiten.DrawImageOptions{} op.GeoM.Translate(xd, yd) //op.GeoM.Rotate(math.Pi / 180 * float64(p.increment)) @@ -239,8 +246,10 @@ func (p *Parallax) RepositionTest(screen *ebiten.Image) { x0 := float32(p.Dimensions.Width / 2) y0 := float32(p.Dimensions.Height / 2) - xd := float32(100.0) - yd := float32(100.0) + adjustment := float32(400.0) + + xd := adjustment / 4.0 + yd := adjustment / 4.0 //connect the dots path.MoveTo(x0-xd, y0-yd) @@ -272,11 +281,10 @@ func (p *Parallax) RepositionTest(screen *ebiten.Image) { roX := float64(178 / 4) roY := float64(229 / 4) - startX := float64(maxX) + roX + startX := float64(maxX) + roX*2 startY := float64(y0) + roY/2 - adjustment := 400.0 - currentX := startX - float64(p.increment) + adjustment*math.Floor(float64(p.increment)/adjustment) + currentX := startX - float64(p.increment) + float64(adjustment)*math.Floor(float64(p.increment)/float64(adjustment)) op := &ebiten.DrawImageOptions{} op.GeoM.Scale(.5, .5)