atlantis/pickups/starfish.lua
Hugues Ross 4cc7e02155 Add initial inventory code
- Player can hold items up to the stack limit
- Player can purchase items
- Items can't be used or seen yet
2021-01-29 08:06:15 -05:00

32 lines
650 B
Lua

local physics = require("physics")
local starfish = {
}
function starfish.new(x, y)
return {
x = x,
y = y,
width = 12,
height = 12,
update = starfish.update,
draw = starfish.draw,
sprite = love.graphics.newImage("sprites/starfish.png"),
value = 1,
}
end
function starfish.update(self, player, level, dt)
if physics.boxCollide(self, player) then
player.score = player.score + self.value
self.dead = true
end
end
function starfish.draw(self)
love.graphics.setColor(1, 1, 1)
love.graphics.draw(self.sprite, self.x, self.y);
end
return starfish