Lighting experiments
This commit is contained in:
@@ -90,6 +90,10 @@ type Hero struct {
|
||||
lastAnimKey animationKey
|
||||
|
||||
ProjectileConfig projectile.ProjectileConfig
|
||||
|
||||
// Lighting state
|
||||
InShadow bool
|
||||
ShadowIntensity float64
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
@@ -358,6 +362,11 @@ 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)
|
||||
}
|
||||
|
||||
op.Filter = ebiten.FilterNearest
|
||||
screen.DrawImage(sprite, op)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user