summaryrefslogtreecommitdiff
path: root/objects
diff options
context:
space:
mode:
Diffstat (limited to 'objects')
-rw-r--r--objects/Loot.lua7
-rw-r--r--objects/Player.lua6
2 files changed, 11 insertions, 2 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
diff --git a/objects/Player.lua b/objects/Player.lua
index 5103b17..2701f53 100644
--- a/objects/Player.lua
+++ b/objects/Player.lua
@@ -16,7 +16,7 @@ function Player.new()
zoom = 1/16,
speed = config.player.speed,
shieldedTill = 0,
- hearts = { "purpleheart", "redheart", "redheart", "redheart", "shinyheart", "shinyheart", "stickyheart" },
+ hearts = { "redheart", "redheart", "redheart" },
facing = Direction.DOWN,
moving = false,
frameTimer = FrameTimer:new(config.frameRate, 2),
@@ -29,6 +29,10 @@ function Player.new()
return player
end
+function Player.init(G)
+ G.player = Player:new()
+end
+
-- placement and location
function Player:setX(x)