summaryrefslogtreecommitdiff
path: root/objects/Loot.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-16 21:31:13 +0800
committerEltrac <hi@guhub.cn>2025-03-16 21:31:13 +0800
commit2c24af53829edaf2b6473a438d74adcdac1fdc96 (patch)
treed6a586dc30eb6ea849320e7abea2979668085eb7 /objects/Loot.lua
parent254afa93abe7dfec2f4bc1ee16a56436343c05f6 (diff)
refactor: clearer initialization code
Diffstat (limited to 'objects/Loot.lua')
-rw-r--r--objects/Loot.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/objects/Loot.lua b/objects/Loot.lua
index 1e39211..e0817cc 100644
--- a/objects/Loot.lua
+++ b/objects/Loot.lua
@@ -1,4 +1,4 @@
-local physics = require "logic.physics"
+local heartTypes = require "data.heartTypes"
local Loot = {}
Loot.__index = Loot
@@ -18,6 +18,11 @@ function Loot:new(name, x, y)
return obj
end
+function Loot:random(x, y)
+ local type = utils.any(heartTypes)
+ return Loot:new(type, x, y)
+end
+
function Loot:onContact(other)
local loots = G.currentRoom.objects.loots
if other.objectType == "player" then