Fixed lighting
This commit is contained in:
@@ -91,9 +91,7 @@ type Hero struct {
|
||||
|
||||
ProjectileConfig projectile.ProjectileConfig
|
||||
|
||||
// Lighting state
|
||||
InShadow bool
|
||||
ShadowIntensity float64
|
||||
Brightness float64
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -149,6 +147,7 @@ func New(cfg Config) *Hero {
|
||||
Radius: 4.0,
|
||||
Color: color.NRGBA{R: 255, G: 0, B: 0, A: 255},
|
||||
},
|
||||
Brightness: 1.0,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -362,9 +361,8 @@ func (h *Hero) Draw(screen *ebiten.Image) {
|
||||
// no color modification for idle
|
||||
}
|
||||
|
||||
if h.InShadow {
|
||||
darkness := 1.0 - h.ShadowIntensity
|
||||
op.ColorScale.Scale(float32(darkness), float32(darkness), float32(darkness), 1.0)
|
||||
if h.Brightness < 1.0 {
|
||||
op.ColorScale.Scale(float32(h.Brightness), float32(h.Brightness), float32(h.Brightness), 1.0)
|
||||
}
|
||||
|
||||
op.Filter = ebiten.FilterNearest
|
||||
|
||||
Reference in New Issue
Block a user