diff options
Diffstat (limited to 'objects')
| -rw-r--r-- | objects/Door.lua | 32 | ||||
| -rw-r--r-- | objects/Enemy.lua | 8 | ||||
| -rw-r--r-- | objects/room.lua | 31 |
3 files changed, 0 insertions, 71 deletions
diff --git a/objects/Door.lua b/objects/Door.lua index 58f08b3..daaeae4 100644 --- a/objects/Door.lua +++ b/objects/Door.lua @@ -45,36 +45,4 @@ function Door:setTo(room) self.to = room end -function Door.connect(room1, room2, way) - local door1, door2 - - if type(way) == "number" then - local ways = {"lr","rl","tb","bt"} - way = ways[way] - end - - if way == "lr" then - door1 = Door:new(Direction.LEFT, room1, room2) - door2 = Door:new(Direction.RIGHT, room2, room1) - room1:addDoor(door1) - room2:addDoor(door2) - elseif way == "rl" then - door1 = Door:new(Direction.RIGHT, room1, room2) - door2 = Door:new(Direction.LEFT, room2, room1) - room1:addDoor(door1) - room2:addDoor(door2) - elseif way == "tb" then - door1 = Door:new(Direction.TOP, room1, room2) - door2 = Door:new(Direction.BOTTOM, room2, room1) - room1:addDoor(door1) - room2:addDoor(door2) - elseif way == "bt" then - door1 = Door:new(Direction.BOTTOM, room1, room2) - door2 = Door:new(Direction.TOP, room2, room1) - room1:addDoor(door1) - room2:addDoor(door2) - end - return door1, door2 -end - return Door diff --git a/objects/Enemy.lua b/objects/Enemy.lua index 524a1ce..6c0e603 100644 --- a/objects/Enemy.lua +++ b/objects/Enemy.lua @@ -29,12 +29,4 @@ function Enemy:moveTowardPlayer(dt) end end -function Enemy.generate(count, room) - local enemies = {} - for i = 1, count do - table.insert(enemies, Enemy:new("normal", room)) - end - return enemies -end - return Enemy diff --git a/objects/room.lua b/objects/room.lua index 0edac69..4ae92ab 100644 --- a/objects/room.lua +++ b/objects/room.lua @@ -55,35 +55,4 @@ function Room:addDoor(door) table.insert(self.doors, door) end -function Room.switch(to) - local destination - if type(to) == "table" then - destination = to - elseif type(to) == "number" then - destination = G.currentRoom.doors[Direction[to]] - end - - G.currentRoom = destination - G.enemies = destination.enemies -end - -function Room.generate(roomCount) - local rooms = {} - local room1 = Room:new() - table.insert(rooms, room1) - - for i = 2, roomCount do - local newRoom = Room:new() - local previousRoom = rooms[math.random(#rooms)] - - newRoom.enemies = Enemy.generate(math.random(3,6), newRoom) - - Door.connect(previousRoom, newRoom, math.random(4)) - - table.insert(rooms, newRoom) - end - - return rooms[1] -end - return Room |
