Applying reposition test results to dynamic bg.

This commit is contained in:
dbenavid
2023-09-05 19:27:53 -04:00
parent 10d6cad4a3
commit 296f56df72

View File

@@ -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 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 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 = &ebiten.DrawImageOptions{}
op.GeoM.Translate(xd, yd) op.GeoM.Translate(xd, yd)
//op.GeoM.Rotate(math.Pi / 180 * float64(p.increment)) //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) x0 := float32(p.Dimensions.Width / 2)
y0 := float32(p.Dimensions.Height / 2) y0 := float32(p.Dimensions.Height / 2)
xd := float32(100.0) adjustment := float32(400.0)
yd := float32(100.0)
xd := adjustment / 4.0
yd := adjustment / 4.0
//connect the dots //connect the dots
path.MoveTo(x0-xd, y0-yd) path.MoveTo(x0-xd, y0-yd)
@@ -272,11 +281,10 @@ func (p *Parallax) RepositionTest(screen *ebiten.Image) {
roX := float64(178 / 4) roX := float64(178 / 4)
roY := float64(229 / 4) roY := float64(229 / 4)
startX := float64(maxX) + roX startX := float64(maxX) + roX*2
startY := float64(y0) + roY/2 startY := float64(y0) + roY/2
adjustment := 400.0 currentX := startX - float64(p.increment) + float64(adjustment)*math.Floor(float64(p.increment)/float64(adjustment))
currentX := startX - float64(p.increment) + adjustment*math.Floor(float64(p.increment)/adjustment)
op := &ebiten.DrawImageOptions{} op := &ebiten.DrawImageOptions{}
op.GeoM.Scale(.5, .5) op.GeoM.Scale(.5, .5)