47 lines
815 B
Lua
47 lines
815 B
Lua
local window = require('window')
|
|
-- item prototype
|
|
-- name
|
|
-- image
|
|
-- description
|
|
|
|
local m = {
|
|
_t = 'item',
|
|
x = 0,
|
|
y = 0,
|
|
width = 60,
|
|
height = 60,
|
|
name = "item",
|
|
description = "sample description",
|
|
}
|
|
|
|
function m:new()
|
|
local mt = { __index = m }
|
|
local i = {}
|
|
setmetatable(i, mt)
|
|
return i
|
|
end
|
|
|
|
function m:setpos(x, y)
|
|
self.x = x
|
|
self.y = y
|
|
end
|
|
|
|
function m:draw()
|
|
love.graphics.draw(self.image, self.x, self, y)
|
|
end
|
|
|
|
function m:pickupMode(room)
|
|
self.mousepressed = window.mousepressed(function (self, x, y, button)
|
|
self:itemMode()
|
|
self.room:remove(self)
|
|
inventory:pickup(self)
|
|
end)
|
|
end
|
|
|
|
function m:itemMode()
|
|
self.mousepressed = window.mousepressed(function (self, x, y, button)
|
|
log:info(self)
|
|
end)
|
|
end
|
|
|
|
return m
|