summaryrefslogtreecommitdiff
path: root/objects/room.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-02-16 11:53:47 +0800
committerEltrac <hi@guhub.cn>2025-02-16 11:53:47 +0800
commit59356d5853a3cc5ce5e72298bf417e8f135a06d7 (patch)
tree06b23c80d94154576766e0500a29785dc4270809 /objects/room.lua
parent5ed4eca6abe89e3faa9057a7eb81cccd9adf16e7 (diff)
refactor: add room arguments getter
Diffstat (limited to 'objects/room.lua')
-rw-r--r--objects/room.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/objects/room.lua b/objects/room.lua
index 0594ab4..a45d088 100644
--- a/objects/room.lua
+++ b/objects/room.lua
@@ -23,6 +23,22 @@ function Room:new()
return obj
end
+function Room:getWidth()
+ return self.width * love.graphics.getWidth()
+end
+
+function Room:getHeight()
+ return self.height * love.graphics.getHeight()
+end
+
+function Room:getX()
+ return (love.graphics.getWidth() - self:getWidth()) / 2
+end
+
+function Room:getY()
+ return (love.graphics.getHeight() - self:getHeight()) / 2
+end
+
function Room:getInitial()
local room = Room:new()
room.doors[math.random(1,4)] = true