diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2012-06-03 21:38:51 -0400 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2012-06-03 21:38:51 -0400 |
commit | e68193a5bacb0f668f09d4a399fbc9c3418d2fa8 (patch) | |
tree | a8a060d8cf624b0ff8af2ee9516316b3f33c4664 /src/com/fourisland | |
parent | 9f38ea990f484c919b8e7986cb38579fc22b78ec (diff) | |
download | frigidearth-e68193a5bacb0f668f09d4a399fbc9c3418d2fa8.tar.gz frigidearth-e68193a5bacb0f668f09d4a399fbc9c3418d2fa8.tar.bz2 frigidearth-e68193a5bacb0f668f09d4a399fbc9c3418d2fa8.zip |
Added death condition
Now, when you reach zero health, you are promted to quit the game. Also, Window, ShatteredWindow and Snow tiles were added in preparation for the key rooms.
Diffstat (limited to 'src/com/fourisland')
-rw-r--r-- | src/com/fourisland/frigidearth/MapViewGameState.java | 18 | ||||
-rw-r--r-- | src/com/fourisland/frigidearth/Tile.java | 43 |
2 files changed, 60 insertions, 1 deletions
diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index 65bfbe7..e0cc8cb 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java | |||
@@ -191,7 +191,7 @@ public class MapViewGameState implements GameState | |||
191 | if (ways == 0) | 191 | if (ways == 0) |
192 | { | 192 | { |
193 | grid[newx][newy] = Tile.DownStairs; | 193 | grid[newx][newy] = Tile.DownStairs; |
194 | playerx=newx+1; | 194 | playerx=newx; |
195 | playery=newy; | 195 | playery=newy; |
196 | state = 10; | 196 | state = 10; |
197 | break; | 197 | break; |
@@ -673,6 +673,22 @@ public class MapViewGameState implements GameState | |||
673 | 673 | ||
674 | adjustViewport(); | 674 | adjustViewport(); |
675 | calculateFieldOfView(); | 675 | calculateFieldOfView(); |
676 | |||
677 | if (health <= 0) | ||
678 | { | ||
679 | printMessage("You have died! Press [ENTER] to quit."); | ||
680 | |||
681 | Main.addInputable(new Inputable() { | ||
682 | @Override | ||
683 | public void processInput(KeyEvent e) | ||
684 | { | ||
685 | if (e.getKeyCode() == KeyEvent.VK_ENTER) | ||
686 | { | ||
687 | System.exit(0); | ||
688 | } | ||
689 | } | ||
690 | }); | ||
691 | } | ||
676 | } | 692 | } |
677 | 693 | ||
678 | private void adjustViewport() | 694 | private void adjustViewport() |
diff --git a/src/com/fourisland/frigidearth/Tile.java b/src/com/fourisland/frigidearth/Tile.java index be17d6c..5d758e2 100644 --- a/src/com/fourisland/frigidearth/Tile.java +++ b/src/com/fourisland/frigidearth/Tile.java | |||
@@ -109,6 +109,49 @@ public enum Tile | |||
109 | { | 109 | { |
110 | return new Color(162, 181, 205); | 110 | return new Color(162, 181, 205); |
111 | } | 111 | } |
112 | }, | ||
113 | Window { | ||
114 | public boolean isBlocked() | ||
115 | { | ||
116 | return true; | ||
117 | } | ||
118 | |||
119 | public char getDisplayCharacter() | ||
120 | { | ||
121 | return 'W'; | ||
122 | } | ||
123 | |||
124 | public Color getBackgroundColor() | ||
125 | { | ||
126 | return new Color(0, 63, 135); | ||
127 | } | ||
128 | }, | ||
129 | ShatteredWindow { | ||
130 | public boolean isBlocked() | ||
131 | { | ||
132 | return false; | ||
133 | } | ||
134 | |||
135 | public char getDisplayCharacter() | ||
136 | { | ||
137 | return 'W'; | ||
138 | } | ||
139 | |||
140 | public Color getBackgroundColor() | ||
141 | { | ||
142 | return new Color(162, 181, 205); | ||
143 | } | ||
144 | }, | ||
145 | Snow { | ||
146 | public boolean isBlocked() | ||
147 | { | ||
148 | return false; | ||
149 | } | ||
150 | |||
151 | public Color getBackgroundColor() | ||
152 | { | ||
153 | return new Color(255, 250, 250); | ||
154 | } | ||
112 | }; | 155 | }; |
113 | 156 | ||
114 | public abstract boolean isBlocked(); | 157 | public abstract boolean isBlocked(); |