aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-08-30 14:20:24 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-08-30 14:20:24 +0200
commit274417a16e4f0f62dec71614da533236cfcd9abf (patch)
tree40195509bf75baadae53823cd28432419481490e
parentfe270d1509fa62832e8ade9cb48e6ca86b07d57f (diff)
fix: Only one person may be selected at a time
-rw-r--r--main.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/main.go b/main.go
index 150b57e..80574a2 100644
--- a/main.go
+++ b/main.go
@@ -42,12 +42,15 @@ func (g *Game) Update() error {
}
}
if inpututil.IsMouseButtonJustReleased(ebiten.MouseButtonLeft) {
+ // TODO: Drag & select
x, y := ebiten.CursorPosition()
tileClick := Point{x - soil.Position.X, y - soil.Position.Y}
+ canBeSelected := true
for _, p := range g.Persons {
p.IsSelected = false
if tileClick.In(p.CollisionBounds()) {
- p.IsSelected = true
+ p.IsSelected = canBeSelected
+ canBeSelected = false
}
}
}