From 6df5f69c38f4605efa8bf4676730ff60660f54b7 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 3 Jun 2012 14:30:15 -0400 Subject: Added staircases and updated readme --- README.md | 10 ++++-- .../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 @@ -frigidearth +Frigid Earth =========== -2012 seven day rougelike entry \ No newline at end of file +A seven day roguelike about being the last person left on an Earth that has become too cold to sustain life. + +This project is still being worked on! I'm posting daily updates about my progress on my blog: + +# [Day 1](http://www.fourisland.com/2012/06/frigid-earth-day-1/) + +© 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 } } } + + int newx = 0; + int newy = 0; + int ways = 0; + int state = 0; + while (state != 10) + { + for (int testing = 0; testing < 1000; testing++) + { + newx = Functions.random(1, GAME_WIDTH-1); + newy = Functions.random(1, GAME_HEIGHT-2); + ways = 4; + + for (Direction dir : Direction.values()) + { + Point to = dir.to(new Point(newx, newy)); + if ((grid[to.x][to.y] == Tile.DirtFloor) || (grid[to.x][to.y] == Tile.Corridor)) + { + ways--; + } + } + + if (state == 0) + { + if (ways == 0) + { + grid[newx][newy] = Tile.UpStairs; + state = 1; + break; + } + } else if (state == 1) + { + if (ways == 0) + { + grid[newx][newy] = Tile.DownStairs; + state = 10; + break; + } + } + } + } } private boolean makeRoom(int x, int y, Direction direction) -- cgit 1.4.1