diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2012-06-03 14:30:15 -0400 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2012-06-03 14:30:15 -0400 |
commit | 6df5f69c38f4605efa8bf4676730ff60660f54b7 (patch) | |
tree | 8f18c16c1c3d13b5da976abe40b482e8248e7bb3 /src/com/fourisland | |
parent | b50ccd824487a38ced129c4826b1afb8adf569aa (diff) | |
download | frigidearth-6df5f69c38f4605efa8bf4676730ff60660f54b7.tar.gz frigidearth-6df5f69c38f4605efa8bf4676730ff60660f54b7.tar.bz2 frigidearth-6df5f69c38f4605efa8bf4676730ff60660f54b7.zip |
Added staircases and updated readme
Diffstat (limited to 'src/com/fourisland')
-rw-r--r-- | src/com/fourisland/frigidearth/MapViewGameState.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/com/fourisland/frigidearth/MapViewGameState.java b/src/com/fourisland/frigidearth/MapViewGameState.java index c6f82d0..d85608a 100644 --- a/src/com/fourisland/frigidearth/MapViewGameState.java +++ b/src/com/fourisland/frigidearth/MapViewGameState.java | |||
@@ -150,6 +150,47 @@ public class MapViewGameState implements GameState | |||
150 | } | 150 | } |
151 | } | 151 | } |
152 | } | 152 | } |
153 | |||
154 | int newx = 0; | ||
155 | int newy = 0; | ||
156 | int ways = 0; | ||
157 | int state = 0; | ||
158 | while (state != 10) | ||
159 | { | ||
160 | for (int testing = 0; testing < 1000; testing++) | ||
161 | { | ||
162 | newx = Functions.random(1, GAME_WIDTH-1); | ||
163 | newy = Functions.random(1, GAME_HEIGHT-2); | ||
164 | ways = 4; | ||
165 | |||
166 | for (Direction dir : Direction.values()) | ||
167 | { | ||
168 | Point to = dir.to(new Point(newx, newy)); | ||
169 | if ((grid[to.x][to.y] == Tile.DirtFloor) || (grid[to.x][to.y] == Tile.Corridor)) | ||
170 | { | ||
171 | ways--; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | if (state == 0) | ||
176 | { | ||
177 | if (ways == 0) | ||
178 | { | ||
179 | grid[newx][newy] = Tile.UpStairs; | ||
180 | state = 1; | ||
181 | break; | ||
182 | } | ||
183 | } else if (state == 1) | ||
184 | { | ||
185 | if (ways == 0) | ||
186 | { | ||
187 | grid[newx][newy] = Tile.DownStairs; | ||
188 | state = 10; | ||
189 | break; | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | } | ||
153 | } | 194 | } |
154 | 195 | ||
155 | private boolean makeRoom(int x, int y, Direction direction) | 196 | private boolean makeRoom(int x, int y, Direction direction) |