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 | |
| parent | b50ccd824487a38ced129c4826b1afb8adf569aa (diff) | |
| download | frigidearth-6df5f69c38f4605efa8bf4676730ff60660f54b7.tar.gz frigidearth-6df5f69c38f4605efa8bf4676730ff60660f54b7.tar.bz2 frigidearth-6df5f69c38f4605efa8bf4676730ff60660f54b7.zip | |
Added staircases and updated readme
| -rw-r--r-- | README.md | 10 | ||||
| -rw-r--r-- | src/com/fourisland/frigidearth/MapViewGameState.java | 41 |
2 files changed, 49 insertions, 2 deletions
| diff --git a/README.md b/README.md index ca63a11..fe9e1cd 100644 --- a/README.md +++ b/README.md | |||
| @@ -1,4 +1,10 @@ | |||
| 1 | frigidearth | 1 | Frigid Earth |
| 2 | =========== | 2 | =========== |
| 3 | 3 | ||
| 4 | 2012 seven day rougelike entry \ No newline at end of file | 4 | A seven day roguelike about being the last person left on an Earth that has become too cold to sustain life. |
| 5 | |||
| 6 | This project is still being worked on! I'm posting daily updates about my progress on my blog: | ||
| 7 | |||
| 8 | # [Day 1](http://www.fourisland.com/2012/06/frigid-earth-day-1/) | ||
| 9 | |||
| 10 | © 2012 Starla Insigna | ||
| 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) |
