aboutsummaryrefslogtreecommitdiff
path: root/entity.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2025-07-04 23:55:19 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2025-07-04 23:57:36 +0200
commit56b3d85afaf260be93e46e2b930f79ade461789b (patch)
treed15e08f5c29d94b363b04e00c35044d63f762a06 /entity.go
parent548b18531aed2eeb284ce121832070bd10822d4f (diff)
Simple refactor
Diffstat (limited to 'entity.go')
-rw-r--r--entity.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/entity.go b/entity.go
index 8d6dfb9..a9fd0ff 100644
--- a/entity.go
+++ b/entity.go
@@ -26,9 +26,10 @@ func (e Entity) Bounds() physics.Rectangle {
}
func Draw(screen *ebiten.Image, e *Entity) {
- if e.Image.IsEnabled && e.Position.IsEnabled {
- op := &ebiten.DrawImageOptions{}
- op.GeoM.Translate(float64(e.Position.Value.X), float64(e.Position.Value.Y))
- screen.DrawImage(e.Image.Value, op)
+ if !e.Image.IsEnabled || !e.Position.IsEnabled {
+ return
}
+ op := &ebiten.DrawImageOptions{}
+ op.GeoM.Translate(float64(e.Position.Value.X), float64(e.Position.Value.Y))
+ screen.DrawImage(e.Image.Value, op)
}