diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-22 13:19:07 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-22 13:19:07 +0200 |
| commit | 300bd942025cf394a1806851313f87a6dfb6c94e (patch) | |
| tree | d4eb5e92781386e0988e24aaff9fefc94b99348e | |
| parent | 8acdf093417ac71f6ab3cab4d9e9978005dcd792 (diff) | |
| download | muhqs-game-300bd942025cf394a1806851313f87a6dfb6c94e.tar.gz muhqs-game-300bd942025cf394a1806851313f87a6dfb6c94e.zip | |
fix order of selector chars for the tower tile
| -rw-r--r-- | go/game/map.go | 2 | ||||
| -rw-r--r-- | go/ui/mapView.go | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/go/game/map.go b/go/game/map.go index 691643aa..75621b71 100644 --- a/go/game/map.go +++ b/go/game/map.go @@ -473,7 +473,7 @@ func RandomMapFromDef(seed int64, def randomMapDef) *Map { func RandomMap(seed int64, players int) *Map { n := rand.Intn(10) + 3 types := []TileType{neutral, neutral} - exclude := []TileType{spawn, docks, gate, wall, tower, farm} + exclude := []TileType{spawn, docks, gate, wall, farm} for range n { for { t := TileType(rand.Intn(9) + 1) diff --git a/go/ui/mapView.go b/go/ui/mapView.go index 29b1ddd3..83404241 100644 --- a/go/ui/mapView.go +++ b/go/ui/mapView.go @@ -5,7 +5,6 @@ import ( "image" "image/color" "math" - "strings" "unicode" "github.com/hajimehoshi/ebiten/v2" @@ -198,6 +197,15 @@ func (vw *MapView) handleTower(x, y int, op *ebiten.DrawImageOptions) *ebiten.Im return assets.GetTile("tower") } + // corner cases where tower is placed on the edge + if (left || above) && len(vw.gameState.Map().Tiles[y])-1 == x { + right = true + } + + if (right || above) && x == 0 { + left = true + } + selector := "" if left { selector += "l" @@ -208,14 +216,6 @@ func (vw *MapView) handleTower(x, y int, op *ebiten.DrawImageOptions) *ebiten.Im if above { selector += "u" } - // corner cases where tower is placed on the edge - if selector != "" && !strings.Contains(selector, "r") && len(vw.gameState.Map().Tiles[y])-1 == x { - selector += "r" - } - - if selector != "" && !strings.Contains(selector, "l") && x == 0 { - selector += "l" - } tileName := "tower" if selector != "" { |
