diff options
| author | Eltrac <hi@guhub.cn> | 2025-02-19 11:00:03 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-02-19 11:00:03 +0800 |
| commit | 4e889cae1848a0e589f4fe94e83fbd91c1f9fcc2 (patch) | |
| tree | 75f0e7f445ebd85736d9914acd446bb38745c5c7 /objects/room.lua | |
| parent | 195dc2b37eb3c9dd6686012d405b44384ce6d4cd (diff) | |
refactor: separate logic and object
Diffstat (limited to 'objects/room.lua')
| -rw-r--r-- | objects/room.lua | 31 |
1 files changed, 0 insertions, 31 deletions
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 |
