Skip to content

Commit

Permalink
examples: Add colours to sokoban
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddiM8 committed Oct 12, 2024
1 parent a824ff2 commit 2c7677f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/sokoban/main.elk
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ fn rowToString(board, y) {

let blockType = block | sokoban::block::getType
if blockType == "wall" {
row += "#"
row += "#" | ansi::color brightBlack
} else if blockType == "crate" {
row += if board | sokoban::blockIsOnStorage(block): "*" else "o"
let char = if board | sokoban::blockIsOnStorage(block): "*" else "o"
row += char | ansi::color blue
} else if blockType == "player" {
row += if board | sokoban::blockIsOnStorage(block): "+" else "@"
let char = if board | sokoban::blockIsOnStorage(block): "+" else "@"
row += char | ansi::color red
} else if blockType == "storage" {
row += "."
row += "." | ansi::color brightRed
}
}

Expand Down

0 comments on commit 2c7677f

Please sign in to comment.