From d7855c69c210c611783df1058819c98983a8b9d1 Mon Sep 17 00:00:00 2001 From: Hyeonung Baek Date: Wed, 15 Jan 2025 19:59:05 +0900 Subject: [PATCH] Small change --- entity.lua | 1 + item.lua | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/entity.lua b/entity.lua index 69f3b93..f184422 100644 --- a/entity.lua +++ b/entity.lua @@ -65,6 +65,7 @@ m.mousepressed = window.mousepressed(function (self, x, y, button) end) function m:install(room, x, y) + self.room = room self:setpos(x, y) room:insert(self) end diff --git a/item.lua b/item.lua index b96249f..5226d28 100644 --- a/item.lua +++ b/item.lua @@ -30,12 +30,14 @@ function m:itemMode() end) end +local install = m.install function m:install(room, x, y) - local i = self:new() - i.room = room - i:pickupMode() - i:setpos(x, y) - room:insert(i) + self:pickupMode() + install(self, room, x, y) +end + +function m:spawn(room, x, y) + self:new():install(room, x, y) end return m