diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2013-04-01 23:01:59 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2013-04-01 23:01:59 -0400 |
commit | e77c8b23c148ffaa5991da18c981e61db2a5e55c (patch) | |
tree | 23cb193169eaf72587fc20085754d7818b117407 /Fallen/Tiles.hs | |
parent | 0bdac482014e4bffb04005fbc09c16aa5f612b8f (diff) | |
download | fallen-hs-e77c8b23c148ffaa5991da18c981e61db2a5e55c.tar.gz fallen-hs-e77c8b23c148ffaa5991da18c981e61db2a5e55c.tar.bz2 fallen-hs-e77c8b23c148ffaa5991da18c981e61db2a5e55c.zip |
Initial commit
Haskell version now has most of the functionality from the C++ version, except for color, and overworld generation is REALLY slow.
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 | ||