aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2023-09-18 21:55:14 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2023-09-18 21:55:14 +0200
commitdc17461910194815ff9b329f386f17d6218a5853 (patch)
treeb41d3403ca8c411fa850892fdb508e9ba386ea16 /main.go
parenta88cd8651b57c8e94a7f7d04c5a55657896de684 (diff)
feat: Move avoid colision between moving entities
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/main.go b/main.go
index 8d49043..900429c 100644
--- a/main.go
+++ b/main.go
@@ -80,7 +80,7 @@ func (g *Game) Update() error {
g.updateSelecting(cursor)
}
for _, e := range g.Entities {
- e.UpdateMove()
+ e.UpdateMove(g.getMoveMap())
}
return nil
}
@@ -118,13 +118,20 @@ func main() {
game.Entities = append(game.Entities, &ironMine)
personImage := NewColorImage(Point{100, 100}, color.RGBA{0xff, 0xff, 0xff, 0xff})
personSelectedImage := NewHaloImage(personImage, color.RGBA{0xff, 0x00, 0x00, 0xff}, 10)
- alterPerson := Entity{
+ person1 := Entity{
Position: C(Point{2000, 2000}),
Image: C(personImage),
Selection: C(Selection{IsSelected: false, SelectedImage: personSelectedImage}),
Move: C(Move{IsActive: false}),
}
- game.Entities = append(game.Entities, &alterPerson)
+ game.Entities = append(game.Entities, &person1)
+ person2 := Entity{
+ Position: C(Point{2200, 2200}),
+ Image: C(personImage),
+ Selection: C(Selection{IsSelected: false, SelectedImage: personSelectedImage}),
+ Move: C(Move{IsActive: false}),
+ }
+ game.Entities = append(game.Entities, &person2)
game.CurrentAction = Selecting
if err := ebiten.RunGame(game); err != nil {
panic(err)