logic flip

This commit is contained in:
Josh Deprez 2021-08-26 09:55:55 +10:00
parent e1274a7beb
commit 056f0cf5d5

View file

@ -87,18 +87,20 @@ func (c *Camera) Draw(screen *ebiten.Image, opts ebiten.DrawImageOptions) {
// Draw everything. // Draw everything.
for _, i := range c.Scene.Scan() { for _, i := range c.Scene.Scan() {
if d, ok := i.(Drawer); ok { d, ok := i.(Drawer)
pf := 1.0 if !ok {
if s, ok := i.(ParallaxScaler); ok { continue
pf = s.ParallaxFactor()
}
var geom ebiten.GeoM
// 1. Move centre to the origin, subject to parallax factor
geom.Translate(-float64(centre.X)*pf, -float64(centre.Y)*pf)
geom.Concat(comm)
opts.GeoM = geom
d.Draw(screen, opts)
} }
pf := 1.0
if s, ok := i.(ParallaxScaler); ok {
pf = s.ParallaxFactor()
}
var geom ebiten.GeoM
// 1. Move centre to the origin, subject to parallax factor
geom.Translate(-float64(centre.X)*pf, -float64(centre.Y)*pf)
geom.Concat(comm)
opts.GeoM = geom
d.Draw(screen, opts)
} }
} }