diff options
Diffstat (limited to 'Fallen/Tiles.hs')
-rw-r--r-- | Fallen/Tiles.hs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Fallen/Tiles.hs b/Fallen/Tiles.hs new file mode 100644 index 0000000..e64a650 --- /dev/null +++ b/Fallen/Tiles.hs | |||
@@ -0,0 +1,30 @@ | |||
1 | module Fallen.Tiles | ||
2 | ( Tile(Grass, Earth, Passage, Floor, Forest, Rock, Water), | ||
3 | drawTile, | ||
4 | passableTiles | ||
5 | ) where | ||
6 | import UI.HSCurses.CursesHelper | ||
7 | |||
8 | data Tile = Grass | Earth | Passage | Floor | Forest | Rock | Water deriving (Show) | ||
9 | |||
10 | instance Eq Tile where | ||
11 | Grass == Grass = True | ||
12 | Earth == Earth = True | ||
13 | Passage == Passage = True | ||
14 | Floor == Floor = True | ||
15 | Forest == Forest = True | ||
16 | Rock == Rock = True | ||
17 | Water == Water = True | ||
18 | _ == _ = False | ||
19 | |||
20 | drawCharWithColor ch color = toEnum $ fromEnum ch | ||
21 | |||
22 | drawTile Grass = drawCharWithColor '.' GreenF | ||
23 | drawTile Earth = drawCharWithColor ' ' BlackF | ||
24 | drawTile Passage = drawCharWithColor '.' GreyF | ||
25 | drawTile Floor = drawCharWithColor '.' GreyF | ||
26 | drawTile Forest = drawCharWithColor '~' GreenF | ||
27 | drawTile Rock = drawCharWithColor '*' GreyF | ||
28 | drawTile Water = drawCharWithColor '~' BlueF | ||
29 | |||
30 | passableTiles = [Grass, Passage, Floor] \ No newline at end of file | ||