diff --git a/scripts/create_post.py b/scripts/create_post.py
index 183636d5e..4cb755632 100644
--- a/scripts/create_post.py
+++ b/scripts/create_post.py
@@ -25,7 +25,7 @@ def post_content():
'post'))
template = jinja2.Template(open('templates/post.md').read())
- return template.render(pull=pulls[0])
+ return template.render(pull=pulls[0], version=version.current_version())
def commithash(version):
diff --git a/src/brewing.lua b/src/brewing.lua
index d05eee10b..78b0eb62b 100644
--- a/src/brewing.lua
+++ b/src/brewing.lua
@@ -19,7 +19,7 @@ bundle = {}
--called once when the gamestate is initialized
function state:init()
- self.background = love.graphics.newImage('images/potion_menu.png')
+ self.background = love.graphics.newImage('images/potions/potion_menu.png')
end
--called when the player enters this gamestate
diff --git a/src/images/corn_circles.png b/src/images/cutscenes/corn_circles.png
similarity index 100%
rename from src/images/corn_circles.png
rename to src/images/cutscenes/corn_circles.png
diff --git a/src/images/cornelius_head.png b/src/images/cutscenes/cornelius_head.png
similarity index 100%
rename from src/images/cornelius_head.png
rename to src/images/cutscenes/cornelius_head.png
diff --git a/src/images/cornelius_sparkles.png b/src/images/cutscenes/cornelius_sparkles.png
similarity index 100%
rename from src/images/cornelius_sparkles.png
rename to src/images/cutscenes/cornelius_sparkles.png
diff --git a/src/images/lightning.png b/src/images/cutscenes/lightning.png
similarity index 100%
rename from src/images/lightning.png
rename to src/images/cutscenes/lightning.png
diff --git a/src/images/damage.png b/src/images/damage.png
deleted file mode 100644
index e85ce96b0..000000000
Binary files a/src/images/damage.png and /dev/null differ
diff --git a/src/images/gilbert_beam.png b/src/images/gilbert_beam.png
deleted file mode 100644
index 0ff105543..000000000
Binary files a/src/images/gilbert_beam.png and /dev/null differ
diff --git a/src/images/healthbar.png b/src/images/healthbar.png
deleted file mode 100644
index 0162f3eed..000000000
Binary files a/src/images/healthbar.png and /dev/null differ
diff --git a/src/images/dalmatian.png b/src/images/hiddendoor/dalmatian.png
similarity index 100%
rename from src/images/dalmatian.png
rename to src/images/hiddendoor/dalmatian.png
diff --git a/src/images/dean_closet.png b/src/images/hiddendoor/dean_closet.png
similarity index 100%
rename from src/images/dean_closet.png
rename to src/images/hiddendoor/dean_closet.png
diff --git a/src/images/fireplace.png b/src/images/hiddendoor/fireplace.png
similarity index 100%
rename from src/images/fireplace.png
rename to src/images/hiddendoor/fireplace.png
diff --git a/src/images/hide_greendale.png b/src/images/hiddendoor/hide_greendale.png
similarity index 100%
rename from src/images/hide_greendale.png
rename to src/images/hiddendoor/hide_greendale.png
diff --git a/src/images/painting.png b/src/images/hiddendoor/painting.png
similarity index 100%
rename from src/images/painting.png
rename to src/images/hiddendoor/painting.png
diff --git a/src/images/sandbarrier.png b/src/images/hiddendoor/sandbarrier.png
similarity index 100%
rename from src/images/sandbarrier.png
rename to src/images/hiddendoor/sandbarrier.png
diff --git a/src/images/skulltrigger.png b/src/images/hiddendoor/skulltrigger.png
similarity index 100%
rename from src/images/skulltrigger.png
rename to src/images/hiddendoor/skulltrigger.png
diff --git a/src/images/Note_image.png b/src/images/info/note.png
similarity index 100%
rename from src/images/Note_image.png
rename to src/images/info/note.png
diff --git a/src/images/ladder.png b/src/images/ladder.png
deleted file mode 100644
index a87bd04a7..000000000
Binary files a/src/images/ladder.png and /dev/null differ
diff --git a/src/images/quicksand.png b/src/images/liquid/quicksand.png
similarity index 100%
rename from src/images/quicksand.png
rename to src/images/liquid/quicksand.png
diff --git a/src/images/water2.png b/src/images/liquid/water2.png
similarity index 100%
rename from src/images/water2.png
rename to src/images/liquid/water2.png
diff --git a/src/images/sandplatform.png b/src/images/platforms/sandplatform.png
similarity index 100%
rename from src/images/sandplatform.png
rename to src/images/platforms/sandplatform.png
diff --git a/src/images/sandplatformbreak.png b/src/images/platforms/sandplatformbreak.png
similarity index 100%
rename from src/images/sandplatformbreak.png
rename to src/images/platforms/sandplatformbreak.png
diff --git a/src/images/sandplatformdark.png b/src/images/platforms/sandplatformdark.png
similarity index 100%
rename from src/images/sandplatformdark.png
rename to src/images/platforms/sandplatformdark.png
diff --git a/src/images/sandplatformdarksingle.png b/src/images/platforms/sandplatformdarksingle.png
similarity index 100%
rename from src/images/sandplatformdarksingle.png
rename to src/images/platforms/sandplatformdarksingle.png
diff --git a/src/images/sandplatformdarktriple.png b/src/images/platforms/sandplatformdarktriple.png
similarity index 100%
rename from src/images/sandplatformdarktriple.png
rename to src/images/platforms/sandplatformdarktriple.png
diff --git a/src/images/cauldron.png b/src/images/potions/cauldron.png
similarity index 100%
rename from src/images/cauldron.png
rename to src/images/potions/cauldron.png
diff --git a/src/images/potion_menu.png b/src/images/potions/potion_menu.png
similarity index 100%
rename from src/images/potion_menu.png
rename to src/images/potions/potion_menu.png
diff --git a/src/images/seabluffwave2.png b/src/images/seabluffwave2.png
deleted file mode 100644
index fbbee06b4..000000000
Binary files a/src/images/seabluffwave2.png and /dev/null differ
diff --git a/src/images/selected_ingredient.png b/src/images/selected_ingredient.png
deleted file mode 100644
index 41b78bdbd..000000000
Binary files a/src/images/selected_ingredient.png and /dev/null differ
diff --git a/src/images/ps_paint.png b/src/images/sprites/greendale/ps_paint.png
similarity index 100%
rename from src/images/ps_paint.png
rename to src/images/sprites/greendale/ps_paint.png
diff --git a/src/images/valleyplatform.png b/src/images/valleyplatform.png
deleted file mode 100644
index 11151f9cb..000000000
Binary files a/src/images/valleyplatform.png and /dev/null differ
diff --git a/src/images/water.png b/src/images/water.png
deleted file mode 100644
index b2a2cf504..000000000
Binary files a/src/images/water.png and /dev/null differ
diff --git a/src/images/water3.png b/src/images/water3.png
deleted file mode 100644
index 17eb48f3f..000000000
Binary files a/src/images/water3.png and /dev/null differ
diff --git a/src/images/web.png b/src/images/web.png
deleted file mode 100644
index b64c7b37c..000000000
Binary files a/src/images/web.png and /dev/null differ
diff --git a/src/inventory.lua b/src/inventory.lua
index 6328d2a1d..4016b61ba 100644
--- a/src/inventory.lua
+++ b/src/inventory.lua
@@ -445,9 +445,6 @@ function Inventory:drop()
local height = item.image:getHeight() - 15
- itemProps.width = item.image:getWidth()
- itemProps.height = item.image:getHeight() - 15
-
itemProps.width = itemProps.width or item.image:getWidth()
itemProps.height = itemProps.height or height
diff --git a/src/level.lua b/src/level.lua
index e91944a9f..dd8bda6a2 100644
--- a/src/level.lua
+++ b/src/level.lua
@@ -394,7 +394,9 @@ function Level:update(dt)
end
for i,node in pairs(self.nodes) do
- if node.update then node:update(dt, self.player) end
+ if self.state == 'active' and node.update then
+ node:update(dt, self.player)
+ end
end
self.collider:update(dt)
diff --git a/src/maps/black-caverns.tmx b/src/maps/black-caverns.tmx
index 2c3f3c5a9..201042cb6 100644
--- a/src/maps/black-caverns.tmx
+++ b/src/maps/black-caverns.tmx
@@ -2877,13 +2877,14 @@
-
-
-
-
-
-
-
-
@@ -362,9 +355,10 @@
-
+
-
+
+
diff --git a/src/maps/frozencave-2.tmx b/src/maps/frozencave-2.tmx
index 580bca98a..e28f3a022 100644
--- a/src/maps/frozencave-2.tmx
+++ b/src/maps/frozencave-2.tmx
@@ -29,7 +29,7 @@
-
+
diff --git a/src/maps/gay-island-2.tmx b/src/maps/gay-island-2.tmx
index 0bc211589..a04959021 100644
--- a/src/maps/gay-island-2.tmx
+++ b/src/maps/gay-island-2.tmx
@@ -433,9 +433,10 @@
-
+
-
+
+
diff --git a/src/maps/lab.tmx b/src/maps/lab.tmx
index 45c51020f..85b43ab05 100644
--- a/src/maps/lab.tmx
+++ b/src/maps/lab.tmx
@@ -57,9 +57,10 @@
-
+
-
+
+
diff --git a/src/maps/treeline.tmx b/src/maps/treeline.tmx
index 5f623be86..bb5ebd917 100644
--- a/src/maps/treeline.tmx
+++ b/src/maps/treeline.tmx
@@ -157,9 +157,10 @@
-
+
-
+
+
diff --git a/src/maps/valley-2.tmx b/src/maps/valley-2.tmx
index d477b0a60..97bc26dd7 100644
--- a/src/maps/valley-2.tmx
+++ b/src/maps/valley-2.tmx
@@ -126,8 +126,8 @@
-
-
+
+
@@ -225,7 +225,7 @@
-
+
@@ -233,7 +233,7 @@
-
+
@@ -241,7 +241,7 @@
-
+
@@ -285,7 +285,7 @@
-
+
@@ -382,6 +382,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/maps/valley-3.tmx b/src/maps/valley-3.tmx
index 455f6d6e3..61c6a233a 100644
--- a/src/maps/valley-3.tmx
+++ b/src/maps/valley-3.tmx
@@ -535,7 +535,7 @@
-
+
@@ -543,7 +543,7 @@
-
+
@@ -642,7 +642,7 @@
-
+
@@ -652,7 +652,7 @@
-
+
@@ -662,7 +662,7 @@
-
+
@@ -672,7 +672,7 @@
-
+
@@ -682,7 +682,7 @@
-
+
@@ -692,7 +692,7 @@
-
+
@@ -702,7 +702,7 @@
-
+
@@ -712,7 +712,7 @@
-
+
@@ -727,16 +727,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/src/maps/valley-chili-fields-2.tmx b/src/maps/valley-chili-fields-2.tmx
index 8c4e23414..4d5cf3fe7 100644
--- a/src/maps/valley-chili-fields-2.tmx
+++ b/src/maps/valley-chili-fields-2.tmx
@@ -151,7 +151,7 @@
-
+
diff --git a/src/maps/valley-chili-fields.tmx b/src/maps/valley-chili-fields.tmx
index 67ddb9188..1a1467b0a 100644
--- a/src/maps/valley-chili-fields.tmx
+++ b/src/maps/valley-chili-fields.tmx
@@ -410,9 +410,10 @@
-
+
-
+
+
diff --git a/src/maps/valley-sandpits-2.tmx b/src/maps/valley-sandpits-2.tmx
index 2be4cb0a2..2da8e76c9 100644
--- a/src/maps/valley-sandpits-2.tmx
+++ b/src/maps/valley-sandpits-2.tmx
@@ -94,7 +94,7 @@
-
+
@@ -102,7 +102,7 @@
-
+
@@ -110,7 +110,7 @@
-
+
@@ -118,7 +118,7 @@
-
+
@@ -126,7 +126,7 @@
-
+
@@ -134,7 +134,7 @@
-
+
@@ -1178,7 +1178,7 @@
-
+
@@ -1284,7 +1284,7 @@
-
+
@@ -1293,7 +1293,7 @@
-
+
@@ -1301,7 +1301,7 @@
-
+
@@ -1309,7 +1309,7 @@
-
+
@@ -1318,7 +1318,7 @@
-
+
@@ -1328,7 +1328,7 @@
-
+
@@ -1338,7 +1338,7 @@
-
+
@@ -1348,7 +1348,7 @@
-
+
@@ -1358,7 +1358,7 @@
-
+
@@ -1452,9 +1452,10 @@
-
+
-
+
+
diff --git a/src/maps/valley-sandpits-entrance.tmx b/src/maps/valley-sandpits-entrance.tmx
index 5401e6429..c3a90da9c 100644
--- a/src/maps/valley-sandpits-entrance.tmx
+++ b/src/maps/valley-sandpits-entrance.tmx
@@ -226,7 +226,7 @@
-
+
@@ -238,7 +238,7 @@
-
+
diff --git a/src/maps/valley-sandpits.tmx b/src/maps/valley-sandpits.tmx
index 1d1f80258..2bd26cd42 100644
--- a/src/maps/valley-sandpits.tmx
+++ b/src/maps/valley-sandpits.tmx
@@ -120,7 +120,7 @@
-
+
@@ -128,7 +128,7 @@
-
+
@@ -136,7 +136,7 @@
-
+
@@ -144,7 +144,7 @@
-
+
@@ -152,7 +152,7 @@
-
+
@@ -349,7 +349,7 @@
-
+
@@ -357,7 +357,7 @@
-
+
@@ -365,7 +365,7 @@
-
+
@@ -373,7 +373,7 @@
-
+
@@ -536,9 +536,10 @@
-
+
-
+
+
diff --git a/src/maps/valley-tacotown.tmx b/src/maps/valley-tacotown.tmx
index c1e17eacd..e1893d67e 100644
--- a/src/maps/valley-tacotown.tmx
+++ b/src/maps/valley-tacotown.tmx
@@ -93,7 +93,7 @@
-
+
@@ -155,6 +155,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/maps/valley.tmx b/src/maps/valley.tmx
index e221a2272..0d6ae5465 100644
--- a/src/maps/valley.tmx
+++ b/src/maps/valley.tmx
@@ -6,7 +6,7 @@
-
+
@@ -184,7 +184,7 @@
-
+
@@ -194,7 +194,7 @@
-
+
@@ -204,7 +204,7 @@
-
+
@@ -214,7 +214,7 @@
-
+
@@ -224,7 +224,7 @@
-
+
@@ -234,7 +234,7 @@
-
+
diff --git a/src/maps/village-treeline.tmx b/src/maps/village-treeline.tmx
index 4ecac54d6..60dd28d36 100644
--- a/src/maps/village-treeline.tmx
+++ b/src/maps/village-treeline.tmx
@@ -453,9 +453,10 @@
-
+
-
+
+
diff --git a/src/nodes/activenpcs/blacksmith.lua b/src/nodes/activenpcs/blacksmith.lua
index f8e909c69..bb4e6e932 100644
--- a/src/nodes/activenpcs/blacksmith.lua
+++ b/src/nodes/activenpcs/blacksmith.lua
@@ -26,7 +26,9 @@ return {
}
},
enter = function(activenpc, previous)
- if not previous.isLevel and previous~=Gamestate.get("overworld") then return end
+ if previous and previous.name ~= 'town' then
+ return
+ end
Timer.add(1,function()
activenpc.state = 'talking'
diff --git a/src/nodes/activenpcs/blacksmith_juan.lua b/src/nodes/activenpcs/blacksmith_juan.lua
index 6d2937542..c0a29198a 100644
--- a/src/nodes/activenpcs/blacksmith_juan.lua
+++ b/src/nodes/activenpcs/blacksmith_juan.lua
@@ -26,7 +26,7 @@ return {
player.freeze = false
local screenshot = love.graphics.newImage( love.graphics.newScreenshot() )
if result == "Yes" then
- Gamestate.switch("shopping", player, screenshot, "juans_smithy")
+ Gamestate.stack("shopping", player, screenshot, "juans_smithy")
end
end
player.freeze = true
diff --git a/src/nodes/activenpcs/leslie.lua b/src/nodes/activenpcs/leslie.lua
index c8c1441be..eae0aaa42 100644
--- a/src/nodes/activenpcs/leslie.lua
+++ b/src/nodes/activenpcs/leslie.lua
@@ -26,7 +26,7 @@ return {
player.freeze = false
local screenshot = love.graphics.newImage( love.graphics.newScreenshot() )
if result == "Yes" then
- Gamestate.switch("shopping", player, screenshot, "leslies_box")
+ Gamestate.stack("shopping", player, screenshot, "leslies_box")
end
end
player.freeze = true
diff --git a/src/nodes/cauldron.lua b/src/nodes/cauldron.lua
index 538cf6cbd..8f84aebd0 100644
--- a/src/nodes/cauldron.lua
+++ b/src/nodes/cauldron.lua
@@ -16,7 +16,7 @@ function Cauldron.new(node, collider)
cauldron.width = node.width
cauldron.bb = collider:addRectangle(node.x, node.y, node.width, node.height)
cauldron.bb.node = cauldron
- cauldron.image = love.graphics.newImage('images/cauldron.png')
+ cauldron.image = love.graphics.newImage('images/potions/cauldron.png')
collider:setPassive(cauldron.bb)
return cauldron
end
diff --git a/src/nodes/cornelius_head.lua b/src/nodes/cornelius_head.lua
index 03afb3e0a..9425dae58 100644
--- a/src/nodes/cornelius_head.lua
+++ b/src/nodes/cornelius_head.lua
@@ -4,7 +4,7 @@ local Timer = require 'vendor/timer'
local sound = require 'vendor/TEsound'
local window = require 'window'
local fonts = require 'fonts'
-local player = require 'player'
+local character = require 'character'
local Cornelius = {}
Cornelius.__index = Cornelius
@@ -20,6 +20,7 @@ function Cornelius.new(node, collider)
cornelius.offset = { x = 30, y = 20 }
cornelius.width = node.width
cornelius.height = node.height
+ cornelius.character = character.current()
cornelius.collider = collider
cornelius.collider:setActive()
@@ -77,8 +78,8 @@ function Cornelius:update(dt)
self.position.y = self.y_center + self.y_bob
self:animation():update(dt)
self:moveBoundingBox()
- if self.score >= 4000 and player.character.name == 'pierce' and player.character.costume == 'base'then
- player.character.costume = 'happy'
+ if self.score >= 4000 and self.character.name == 'pierce' and self.character.costume == 'base' then
+ self.character.costume = 'happy'
end
end
@@ -99,5 +100,3 @@ function Cornelius:draw()
end
return Cornelius
-
-
diff --git a/src/nodes/cutscenes/welcome_to_hawkthorne.lua b/src/nodes/cutscenes/welcome_to_hawkthorne.lua
index b9a7c4fd3..4c411fc1c 100644
--- a/src/nodes/cutscenes/welcome_to_hawkthorne.lua
+++ b/src/nodes/cutscenes/welcome_to_hawkthorne.lua
@@ -30,10 +30,10 @@ function Scene.new(node, collider, layer)
scene.y = node.y
scene.finised = false
- scene.head = love.graphics.newImage('images/cornelius_head.png')
- scene.lightning = love.graphics.newImage('images/lightning.png')
- scene.ovalImg = love.graphics.newImage('images/corn_circles.png')
- scene.sparkle = love.graphics.newImage('images/cornelius_sparkles.png')
+ scene.head = love.graphics.newImage('images/cutscenes/cornelius_head.png')
+ scene.lightning = love.graphics.newImage('images/cutscenes/lightning.png')
+ scene.ovalImg = love.graphics.newImage('images/cutscenes/corn_circles.png')
+ scene.sparkle = love.graphics.newImage('images/cutscenes/cornelius_sparkles.png')
scene.nodes = nametable(layer)
scene.nodes.head.opacity = 0
diff --git a/src/nodes/door.lua b/src/nodes/door.lua
index 7cce32a65..5f5204223 100644
--- a/src/nodes/door.lua
+++ b/src/nodes/door.lua
@@ -46,7 +46,7 @@ function Door.new(node, collider)
if door.hideable then
-- necessary for opening/closing doors with a trigger
door.hidden = true
- door.sprite = love.graphics.newImage('images/' .. node.properties.sprite .. '.png')
+ door.sprite = love.graphics.newImage('images/hiddendoor/' .. node.properties.sprite .. '.png')
door.sprite_width = tonumber( node.properties.sprite_width )
door.sprite_height = tonumber( node.properties.sprite_height )
door.grid = anim8.newGrid( door.sprite_width, door.sprite_height, door.sprite:getWidth(), door.sprite:getHeight())
diff --git a/src/nodes/enemies/bat.lua b/src/nodes/enemies/bat.lua
index 59234fd88..e20bd6a06 100644
--- a/src/nodes/enemies/bat.lua
+++ b/src/nodes/enemies/bat.lua
@@ -10,6 +10,7 @@ return {
bb_offset = {x=0, y=-2},
damage = 1,
hp = 1,
+ vulnerabilities = {'blunt'},
jumpkill = false,
antigravity = true,
dyingdelay = 5,
@@ -43,31 +44,40 @@ return {
enemy.swoop_speed = 150
enemy.fly_speed = 100
enemy.swoop_distance = 150
+ enemy.swoop_ratio = 0.5
+ end,
+ -- adjusts values needed to initialize bat swooping
+ startDive = function ( enemy, player, direction )
+ enemy.state = 'dive'
+ enemy.fly_dir = direction
+ enemy.launch_y = enemy.position.y
+ enemy.swoop_distance = math.abs(player.position.y - enemy.position.y)
+ enemy.swoop_ratio = math.abs(player.position.x - enemy.position.x) / enemy.swoop_distance
+ -- experimentally determined max and min swoop_ratio values
+ enemy.swoop_ratio = math.min(1.4, math.max(0.7, enemy.swoop_ratio))
end,
update = function( dt, enemy, player, level )
if enemy.state == 'dive' then
enemy.position.y = enemy.position.y + dt * enemy.swoop_speed
- enemy.position.x = enemy.position.x + ( dt * ( enemy.swoop_speed / 2 ) * enemy.fly_dir )
+ -- swoop ratio used to center bat on target
+ enemy.position.x = enemy.position.x + ( dt * ( enemy.swoop_speed * enemy.swoop_ratio ) * enemy.fly_dir )
if enemy.launch_y + enemy.swoop_distance < enemy.position.y then
enemy.state = 'flying'
end
elseif enemy.state == 'flying' then
enemy.position.y = enemy.position.y - dt * enemy.fly_speed
+ -- swoop ratio not needed because the bat is not moving to a specific target
enemy.position.x = enemy.position.x + ( dt * ( enemy.swoop_speed / 2 ) * enemy.fly_dir )
elseif enemy.state == 'default' and player.position.y <= enemy.position.y + 100 then
if player.position.x < enemy.position.x then
-- player is to the right
if player.position.x + player.width + 50 >= enemy.position.x then
- enemy.state = 'dive'
- enemy.fly_dir = -1
- enemy.launch_y = enemy.position.y
+ enemy.props.startDive( enemy, player, -1 )
end
else
-- player is to the left
if player.position.x - 50 <= enemy.position.x + enemy.width then
- enemy.state = 'dive'
- enemy.fly_dir = 1
- enemy.launch_y = enemy.position.y
+ enemy.props.startDive( enemy, player, 1 )
end
end
end
diff --git a/src/nodes/enemies/canister.lua b/src/nodes/enemies/canister.lua
index c4357d183..b7e28478f 100644
--- a/src/nodes/enemies/canister.lua
+++ b/src/nodes/enemies/canister.lua
@@ -9,6 +9,7 @@ return {
width = 24,
damage = 0,
hp = 12,
+ vulnerabilities = {'blunt'},
animations = {
dying = {
right = {'once', {'1,2'}, 0.25},
diff --git a/src/nodes/enemies/ducky.lua b/src/nodes/enemies/ducky.lua
index f973e2b4e..0ba2f235e 100644
--- a/src/nodes/enemies/ducky.lua
+++ b/src/nodes/enemies/ducky.lua
@@ -44,11 +44,11 @@ return {
else
enemy.direction = 'right'
end
- enemy.last_jump = enemy.last_jump + dt
+ enemy.last_jump = enemy.last_jump + dt*math.random()
if enemy.last_jump > 4 then
enemy.state = 'jump'
enemy.jumpkill = false
- enemy.last_jump = 0
+ enemy.last_jump = math.random()
enemy.velocity.y = -500
Timer.add(.5, function()
enemy.state = 'default'
diff --git a/src/nodes/enemies/guitarist.lua b/src/nodes/enemies/guitarist.lua
index b3294a39c..3a74d0971 100644
--- a/src/nodes/enemies/guitarist.lua
+++ b/src/nodes/enemies/guitarist.lua
@@ -9,6 +9,7 @@ return {
width = 48,
damage = 4,
bb_width = 30,
+ vulnerabilities = {'stab'},
hp = 16,
tokens = 7,
velocity = { x = 35, y = 0},
diff --git a/src/nodes/enemies/hippy.lua b/src/nodes/enemies/hippy.lua
index b482afd42..67daabe9b 100644
--- a/src/nodes/enemies/hippy.lua
+++ b/src/nodes/enemies/hippy.lua
@@ -10,6 +10,7 @@ return {
bb_offset = {x=0, y=12},
damage = 1,
hp = 6,
+ vulnerabilities = {'slash'},
tokens = 3,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
diff --git a/src/nodes/enemies/humbug.lua b/src/nodes/enemies/humbug.lua
index cabbc05ea..4edb38cad 100644
--- a/src/nodes/enemies/humbug.lua
+++ b/src/nodes/enemies/humbug.lua
@@ -12,6 +12,7 @@ return{
bb_offset = {x=2, y=7},
damage = 1,
hp = 1,
+ vulnerabilities = {'blunt'},
tokens = 1,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
diff --git a/src/nodes/enemies/manicorn.lua b/src/nodes/enemies/manicorn.lua
index ff7442a9c..032d6c3c2 100644
--- a/src/nodes/enemies/manicorn.lua
+++ b/src/nodes/enemies/manicorn.lua
@@ -21,6 +21,7 @@ return {
chargeUpTime = 2,
reviveDelay = 3,
attackDelay = 1,
+ vulnerabilities = {'stab'},
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
{ item = 'health', v = 1, p = 1 }
diff --git a/src/nodes/enemies/mannequin.lua b/src/nodes/enemies/mannequin.lua
index eb5603bc7..335bded8c 100644
--- a/src/nodes/enemies/mannequin.lua
+++ b/src/nodes/enemies/mannequin.lua
@@ -8,6 +8,7 @@ return {
bb_offset = {x=0, y=4},
damage = 2,
hp = 3,
+ vulnerabilities = {'blunt'},
tokens = 3,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
diff --git a/src/nodes/enemies/pinata.lua b/src/nodes/enemies/pinata.lua
index 33eed664e..ca483b5da 100644
--- a/src/nodes/enemies/pinata.lua
+++ b/src/nodes/enemies/pinata.lua
@@ -7,6 +7,7 @@ return {
width = 19,
antigravity = true,
hp = 1,
+ vulnerabilities = {'blunt'},
damage = 0,
dyingdelay = 0.1,
peaceful = true,
diff --git a/src/nodes/enemies/qilin.lua b/src/nodes/enemies/qilin.lua
index cf2a9bbcb..dab0d594a 100644
--- a/src/nodes/enemies/qilin.lua
+++ b/src/nodes/enemies/qilin.lua
@@ -11,6 +11,7 @@ return{
bb_width = 65,
bb_offset = {x=0, y=9},
hp = 25,
+ vulnerabilities = {'blunt'},
damage = 3,
tokens = 10,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
diff --git a/src/nodes/enemies/snowman.lua b/src/nodes/enemies/snowman.lua
index 515d5138f..55bc32bbe 100644
--- a/src/nodes/enemies/snowman.lua
+++ b/src/nodes/enemies/snowman.lua
@@ -10,6 +10,7 @@ return {
width = 38,
damage = 2,
hp = 1,
+ vulnerabilities = {'fire'},
tokens = 4,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
diff --git a/src/nodes/enemies/spider-roaming.lua b/src/nodes/enemies/spider-roaming.lua
index 90a20510d..0bc42bc40 100644
--- a/src/nodes/enemies/spider-roaming.lua
+++ b/src/nodes/enemies/spider-roaming.lua
@@ -22,6 +22,7 @@ return {
bb_offset = {x=0, y=0},
damage = 3,
hp = 12,
+ vulnerabilities = {'fire'},
tokens = 8,
jumpkill = false,
speed = 50,
diff --git a/src/nodes/enemies/spider.lua b/src/nodes/enemies/spider.lua
index 571ed84ec..1cd2383a1 100644
--- a/src/nodes/enemies/spider.lua
+++ b/src/nodes/enemies/spider.lua
@@ -22,6 +22,7 @@ return {
bb_offset = {x=0, y=0},
damage = 3,
hp = 12,
+ vulnerabilities = {'fire'},
tokens = 8,
jumpkill = false,
speed = 50,
diff --git a/src/nodes/enemies/trombonist.lua b/src/nodes/enemies/trombonist.lua
index 10b8195eb..e91560ba6 100644
--- a/src/nodes/enemies/trombonist.lua
+++ b/src/nodes/enemies/trombonist.lua
@@ -9,6 +9,7 @@ return {
width = 58,
damage = 2,
hp = 8,
+ vulnerabilities = {'stab'},
tokens = 4,
velocity = { x = 30, y = 0},
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
diff --git a/src/nodes/enemies/turkey.lua b/src/nodes/enemies/turkey.lua
index 6a4fe715f..936dfd4de 100644
--- a/src/nodes/enemies/turkey.lua
+++ b/src/nodes/enemies/turkey.lua
@@ -15,6 +15,7 @@ return {
bb_offset = {x=4, y=22},
velocity = {x = -20, y = 0},
hp = 8,
+ vulnerabilities = {'slash'},
tokens = 3,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
diff --git a/src/nodes/enemies/violinist.lua b/src/nodes/enemies/violinist.lua
index e017e620b..1ce8afe69 100644
--- a/src/nodes/enemies/violinist.lua
+++ b/src/nodes/enemies/violinist.lua
@@ -9,6 +9,7 @@ return {
width = 48,
damage = 3,
bb_width = 30,
+ vulnerabilities = {'stab'},
hp = 12,
tokens = 6,
velocity = { x = 50, y = 0},
diff --git a/src/nodes/enemies/wasabi.lua b/src/nodes/enemies/wasabi.lua
index 7d6260d2d..84d3a0d41 100644
--- a/src/nodes/enemies/wasabi.lua
+++ b/src/nodes/enemies/wasabi.lua
@@ -11,6 +11,7 @@ return {
bb_offset = {x=0, y=12},
damage = 3,
hp = 8,
+ vulnerabilities = {'lightning'},
tokens = 3,
tokenTypes = { -- p is probability ceiling and this list should be sorted by it, with the last being 1
{ item = 'coin', v = 1, p = 0.9 },
diff --git a/src/nodes/enemy.lua b/src/nodes/enemy.lua
index fde58731a..27de60779 100644
--- a/src/nodes/enemy.lua
+++ b/src/nodes/enemy.lua
@@ -88,6 +88,7 @@ function Enemy.new(node, collider, enemytype)
enemy.offset_hand_right[2] = enemy.props.hand_y or enemy.height/2
enemy.chargeUpTime = enemy.props.chargeUpTime
enemy.player_rebound = enemy.props.player_rebound or 300
+ enemy.vulnerabilities = enemy.props.vulnerabilities or {}
enemy.animations = {}
@@ -138,13 +139,16 @@ function Enemy:animation()
end
end
-function Enemy:hurt(damage)
+function Enemy:hurt( damage, special_damage )
if self.dead then return end
if self.props.die_sound then sound.playSfx( self.props.die_sound ) end
if not damage then damage = 1 end
self.state = 'hurt'
- self.hp = self.hp - damage
+
+ -- Subtract from hp total damage including special damage
+ self.hp = self.hp - self:calculateDamage(damage, special_damage)
+
if self.hp <= 0 then
self.state = 'dying'
self:cancel_flash()
@@ -177,6 +181,20 @@ function Enemy:hurt(damage)
end
end
+-- Compares vulnerabilities to a weapons special damage and sums up total damage
+function Enemy:calculateDamage(damage, special_damage)
+ if not special_damage then
+ return damage
+ end
+ for _, value in ipairs(self.vulnerabilities) do
+ if special_damage[value] ~= nil then
+ damage = damage + special_damage[value]
+ end
+ end
+
+ return damage
+end
+
function Enemy:cancel_flash()
if self.flashing then
Timer.cancel(self.flashing)
diff --git a/src/nodes/firealarm.lua b/src/nodes/firealarm.lua
index 4d03b85cb..3a76ab225 100644
--- a/src/nodes/firealarm.lua
+++ b/src/nodes/firealarm.lua
@@ -9,7 +9,7 @@ Alarm.isInteractive = true
local image = love.graphics.newImage('images/sprites/greendale/firealarm.png')
local not_broken_img = love.graphics.newQuad( 0, 0, 24,72, image:getWidth(), image:getHeight() )
local broken_img = love.graphics.newQuad( 24, 0, 24,72, image:getWidth(), image:getHeight() )
-local psPaintImage = love.graphics.newImage('images/ps_paint.png')
+local psPaintImage = love.graphics.newImage('images/sprites/greendale/ps_paint.png')
local psPaint = love.graphics.newParticleSystem(psPaintImage, 100)
local broken = false
diff --git a/src/nodes/floorspace.lua b/src/nodes/floorspace.lua
index eb875a095..81a2b56c0 100644
--- a/src/nodes/floorspace.lua
+++ b/src/nodes/floorspace.lua
@@ -113,9 +113,9 @@ function Floorspace.new(node, level)
end
function Floorspace:enter()
+ local player = self.level.player
if self.node.properties.primary == 'true' then
Floorspaces:setPrimary( self )
- local player = self.level.player
-- if the player is colliding, and we don't have a footprint, create one
-- ( this should only happen once per level )
if not player.footprint then
@@ -123,7 +123,7 @@ function Floorspace:enter()
player.velocity = {x=0,y=0}
end
local fp = player.footprint
- if not fp:within( self ) then
+ if not fp:within( self ) and not player.jumping then
-- if the footprint isn't within the primary floorspace, then move the footprint straight down until it is. If the distance is far enough, make the player fall
local dst = 0
while not fp:within( self ) do
@@ -136,11 +136,13 @@ function Floorspace:enter()
else
Floorspaces:addObject( self )
end
+ if player.footprint and self.lastknown then
+ player.footprint.x = self.lastknown.x
+ player.footprint.y = self.lastknown.y
+ end
end
function Floorspace:leave()
- -- forget last known footprint position
- if self.lastknown then self.lastknown = nil end
-- clean up any existing footprints
if self.level.player.footprint then
self.level.collider:remove( self.level.player.footprint.bb )
@@ -251,8 +253,8 @@ function Floorspace:collide(node, dt, mtv_x, mtv_y)
if Floorspaces:getPrimary().lastknown then
Floorspaces:getPrimary().lastknown = {
- x = Floorspaces:getPrimary().lastknown.x + mtv_x * 2,
- y = Floorspaces:getPrimary().lastknown.y + mtv_y * 2
+ x = Floorspaces:getPrimary().lastknown.x + mtv_x * 1.01,
+ y = Floorspaces:getPrimary().lastknown.y + mtv_y * 1.01
}
end
end
diff --git a/src/nodes/hiddendoortrigger.lua b/src/nodes/hiddendoortrigger.lua
index 23b06a17a..bc78cdc70 100644
--- a/src/nodes/hiddendoortrigger.lua
+++ b/src/nodes/hiddendoortrigger.lua
@@ -30,7 +30,7 @@ function HiddenDoorTrigger.new(node, collider)
art.message = node.properties.message
art.target = node.properties.target
- art.image = love.graphics.newImage('images/' .. art.sprite .. '.png')
+ art.image = love.graphics.newImage('images/hiddendoor/' .. art.sprite .. '.png')
art.crooked_img = love.graphics.newQuad( art.width, 0, art.width, art.height, art.image:getWidth(), art.image:getHeight() )
art.fixed_img = love.graphics.newQuad( 0, 0, art.width, art.height, art.image:getWidth(), art.image:getHeight() )
diff --git a/src/nodes/info.lua b/src/nodes/info.lua
index 1da846e0a..9bdbbfc2f 100644
--- a/src/nodes/info.lua
+++ b/src/nodes/info.lua
@@ -7,42 +7,50 @@ Info.__index = Info
Info.isInteractive = true
function Info.new(node, collider)
- local info = {}
- setmetatable(info, Info)
- info.bb = collider:addRectangle(node.x, node.y, node.width, node.height)
- info.bb.node = info
- info.info = utils.split(node.properties.info, '|')
-
- info.x = node.x
- info.y = node.y
- info.height = node.height
- info.width = node.width
- info.foreground = 'true'
-
- collider:setPassive(info.bb)
-
- info.current = nil
-
- return info
+ local info = {}
+ setmetatable(info, Info)
+
+ info.bb = collider:addRectangle(node.x, node.y, node.width, node.height)
+ info.bb.node = info
+ info.info = utils.split(node.properties.info, '|')
+
+ info.x = node.x
+ info.y = node.y
+ info.height = node.height
+ info.width = node.width
+ info.position = { x = node.x, y = node.y }
+
+ if node.properties.sprite ~= nil then
+ info.sprite = love.graphics.newImage('images/info/'.. node.properties.sprite ..'.png')
+ end
+
+ collider:setPassive(info.bb)
+
+ info.current = nil
+
+ return info
end
function Info:update(dt, player)
end
function Info:draw()
+ if self.sprite ~= nil then
+ love.graphics.draw(self.sprite, self.position.x, self.position.y)
+ end
end
-function Info:keypressed( button, player )
- if button == 'INTERACT' and self.dialog == nil and not player.freeze then
- player.freeze = true
- self.dialog = Dialog.new(self.info, function()
- self.dialog = nil
- player.freeze = false
- Dialog.currentDialog = nil
- end)
- -- Key has been handled, halt further processing
- return true
- end
+function Info:keypressed( button, player )
+
+ if button == 'INTERACT' and self.dialog == nil and not player.freeze then
+ player.freeze = true
+ Dialog.new(self.info, function()
+ player.freeze = false
+ Dialog.currentDialog = nil
+ end)
+ -- Key has been handled, halt further processing
+ return true
+ end
end
return Info
diff --git a/src/nodes/note.lua b/src/nodes/note.lua
deleted file mode 100644
index f50cebda4..000000000
--- a/src/nodes/note.lua
+++ /dev/null
@@ -1,55 +0,0 @@
-local Dialog = require 'dialog'
-local utils = require 'utils'
-
-local Note = {}
-Note.__index = Note
--- Nodes with 'isInteractive' are nodes which the player can interact with, but not pick up in any way
-Note.isInteractive = true
-
-local noteImage = love.graphics.newImage('images/Note_image.png')
-
-function Note.new(node, collider)
- local note = {}
- setmetatable(note, Note)
- note.image = noteImage
- note.bb = collider:addRectangle(node.x, node.y, node.width, node.height)
- note.bb.node = note
- note.note = utils.split(node.properties.note, '|')
-
- note.x = node.x
- note.y = node.y
- note.height = node.height
- note.width = node.width
- note.position = { x = node.x, y = node.y }
-
-
- collider:setPassive(note.bb)
-
- note.current = nil
-
- return note
-end
-
-function Note:update(dt, player)
-end
-
-function Note:draw()
- love.graphics.draw(self.image, self.position.x, self.position.y)
- --FIXME: put these coordinates in main
- --self.dialog:draw( self.x, self.y - 30 )
-end
-
-function Note:keypressed( button, player )
-
- if button == 'INTERACT' and self.dialog == nil and not player.freeze then
- player.freeze = true
- Dialog.new(self.note, function()
- player.freeze = false
- Dialog.currentDialog = nil
- end)
- -- Key has been handled, halt further processing
- return true
- end
-end
-
-return Note
diff --git a/src/nodes/platform.lua b/src/nodes/platform.lua
index 7425553b4..e69ffa620 100644
--- a/src/nodes/platform.lua
+++ b/src/nodes/platform.lua
@@ -15,14 +15,14 @@ function Platform.new(node, collider)
table.insert(vertices, node.x + point.x)
table.insert(vertices, node.y + point.y)
end
-
+
platform.bb = collider:addPolygon(unpack(vertices))
platform.bb.polyline = polygon
else
platform.bb = collider:addRectangle(node.x, node.y, node.width, node.height)
platform.bb.polyline = nil
end
-
+
platform.node = node
platform.drop = node.properties.drop ~= 'false'
@@ -35,10 +35,16 @@ end
function Platform:collide( node, dt, mtv_x, mtv_y, bb )
bb = bb or node.bb
-
+
if not node.floor_pushback then return end
-
+
if node.isPlayer then
+ --ignore head vs. platform collisions
+ -- ignores node that isn't the one currently standing on
+ if bb == node.top_bb or (node.velocity.y == 0 and mtv_x ~= 0 ) or mtv_y >= 0 then
+ return
+ end
+
self.player_touched = true
if node.platform_dropping == true and self.drop then
@@ -48,32 +54,27 @@ function Platform:collide( node, dt, mtv_x, mtv_y, bb )
if node.platform_dropping == self then
return
end
-
- --ignore head vs. platform collisions
- if bb == node.top_bb then
- return
- end
end
if node.bb then
node.top_bb = node.bb
node.bottom_bb = node.bb
end
-
+
if not node.top_bb or not node.bottom_bb then return end
local _, wy1, _, wy2 = self.bb:bbox()
local px1, py1, _, _ = node.top_bb:bbox()
local _, _, px2, py2 = node.bottom_bb:bbox()
local distance = math.abs(node.velocity.y * dt) + 2.10
-
+
if self.bb.polyline and node.velocity.y >= 0 then
-- If the player is close enough to the tip bring the player to the tip
if math.abs(wy1 - py2) < 2 then
node:floor_pushback(self, wy1 - node.height)
-
+
-- Prevent the player from being treadmilled through an object
elseif self.bb:contains(px2,py2) or self.bb:contains(px1,py2) then
-
+
-- Use the MTV to keep players feet on the ground
node:floor_pushback(self, (py2 - node.height) + mtv_y)
@@ -89,7 +90,6 @@ end
function Platform:collide_end(node)
if node.isPlayer then
self.player_touched = false
- node.platform_dropping = false
end
end
diff --git a/src/nodes/projectile.lua b/src/nodes/projectile.lua
index c53d54458..ecb3e25fd 100644
--- a/src/nodes/projectile.lua
+++ b/src/nodes/projectile.lua
@@ -75,6 +75,9 @@ function Projectile.new(node, collider)
proj.height = proj.props.height
proj.complete = false --updated by finish()
proj.damage = proj.props.damage or 0
+ -- Damage that does not affect all enemies ie. stab, fire
+ -- Don't forget to pass this into hurt functions in the props file
+ proj.special_damage = proj.props.special_damage or {}
proj.solid = proj.props.solid
proj.playerCanPickUp = proj.props.playerCanPickUp
diff --git a/src/nodes/projectiles/arrow.lua b/src/nodes/projectiles/arrow.lua
index e158a93a5..62962e958 100644
--- a/src/nodes/projectiles/arrow.lua
+++ b/src/nodes/projectiles/arrow.lua
@@ -20,6 +20,7 @@ return{
stayOnScreen = false,
thrown = false,
damage = 2,
+ special_damage = {stab = 1},
horizontalLimit = 800,
animations = {
default = {'once', {'1,1'},1},
@@ -29,7 +30,7 @@ return{
collide = function(node, dt, mtv_x, mtv_y,projectile)
if node.isPlayer then return end
if node.hurt then
- node:hurt(projectile.damage)
+ node:hurt(projectile.damage, projectile.special_damage)
projectile:die()
end
end,
diff --git a/src/nodes/projectiles/basketball.lua b/src/nodes/projectiles/basketball.lua
index fe2c8d4bb..132791b3d 100644
--- a/src/nodes/projectiles/basketball.lua
+++ b/src/nodes/projectiles/basketball.lua
@@ -13,13 +13,14 @@ return{
throwVelocityX = 300,
throwVelocityY = -200,
damage = 2,
+ special_damage = {blunt = 1},
playerCanPickUp = false,
enemyCanPickUp = true,
canPlayerStore = false,
collide = function(node, dt, mtv_x, mtv_y,projectile)
if not node.isPlayer then return end
if projectile.thrown then
- node:hurt(projectile.damage)
+ node:hurt(projectile.damage, projectile.special_damage)
end
end,
collide_end = function(node, dt ,projectile)
diff --git a/src/nodes/projectiles/icicle.lua b/src/nodes/projectiles/icicle.lua
index b16e16b91..d0afc85f6 100644
--- a/src/nodes/projectiles/icicle.lua
+++ b/src/nodes/projectiles/icicle.lua
@@ -18,6 +18,7 @@ return{
stayOnScreen = false,
thrown = false,
damage = 2,
+ special_damage = {stab = 1},
horizontalLimit = 330,
animations = {
default = {'once', {'1,1'},1},
@@ -27,7 +28,7 @@ return{
collide = function(node, dt, mtv_x, mtv_y,projectile)
if node.isPlayer then return end
if node.hurt then
- node:hurt(projectile.damage)
+ node:hurt(projectile.damage, projectile.special_damage)
projectile:die()
end
end,
diff --git a/src/nodes/projectiles/lightning.lua b/src/nodes/projectiles/lightning.lua
index 1426cc07f..29aa93619 100644
--- a/src/nodes/projectiles/lightning.lua
+++ b/src/nodes/projectiles/lightning.lua
@@ -20,6 +20,7 @@ return{
stayOnScreen = false,
thrown = false,
damage = 4,
+ special_damage = {lightning = 4},
max_damage = 20,
horizontalLimit = 600,
animations = {
@@ -36,7 +37,7 @@ return{
projectile.max_damage = projectile.props.max_damage
end
if projectile.max_damage > 0 then
- node:hurt(projectile.props.damage)
+ node:hurt(projectile.damage, projectile.special_damage)
projectile.max_damage = projectile.max_damage - projectile.props.damage
else
projectile:die()
diff --git a/src/nodes/projectiles/throwingaxe.lua b/src/nodes/projectiles/throwingaxe.lua
index 0ac558162..5eb50fbb3 100644
--- a/src/nodes/projectiles/throwingaxe.lua
+++ b/src/nodes/projectiles/throwingaxe.lua
@@ -17,6 +17,7 @@ return{
stayOnScreen = false,
thrown = false,
damage = 2,
+ special_damage = {slash = 1},
horizontalLimit = 300,
animations = {
default = {'once', {'1,1'}, 1},
@@ -26,7 +27,7 @@ return{
collide = function(node, dt, mtv_x, mtv_y,projectile)
if node.isPlayer then return end
if node.hurt then
- node:hurt(projectile.damage)
+ node:hurt(projectile.damage, projectile.special_damage)
projectile:die()
end
end,
diff --git a/src/nodes/projectiles/throwingknife.lua b/src/nodes/projectiles/throwingknife.lua
index 87c8ea91b..e4cb6935d 100644
--- a/src/nodes/projectiles/throwingknife.lua
+++ b/src/nodes/projectiles/throwingknife.lua
@@ -18,6 +18,7 @@ return{
stayOnScreen = false,
thrown = false,
damage = 1,
+ special_damage = {stab = 1},
horizontalLimit = 600,
animations = {
default = {'once', {'1,1'},1},
@@ -27,7 +28,7 @@ return{
collide = function(node, dt, mtv_x, mtv_y,projectile)
if node.isPlayer then return end
if node.hurt then
- node:hurt(projectile.damage)
+ node:hurt(projectile.damage, projectile.special_damage)
projectile:die()
end
end,
diff --git a/src/nodes/scenetrigger.lua b/src/nodes/scenetrigger.lua
index 977d0d594..a8acc9218 100644
--- a/src/nodes/scenetrigger.lua
+++ b/src/nodes/scenetrigger.lua
@@ -13,10 +13,6 @@ local camera = require 'camera'
local NAMESPACE = 'cuttriggers.'
-local head = love.graphics.newImage('images/cornelius_head.png')
-local g = anim8.newGrid(144, 192, head:getWidth(), head:getHeight())
-local talking = anim8.newAnimation('loop', g('2,1', '3,1', '1,1'), 0.2)
-
local timeline = {
opacity=0
}
diff --git a/src/nodes/weapon.lua b/src/nodes/weapon.lua
index 85265a449..7b986a7bd 100644
--- a/src/nodes/weapon.lua
+++ b/src/nodes/weapon.lua
@@ -71,6 +71,8 @@ function Weapon.new(node, collider, plyr, weaponItem)
weapon.animation = weapon.defaultAnimation
weapon.damage = node.properties.damage or props.damage or 1
+ -- Damage that does not affect all enemies ie. stab, fire
+ weapon.special_damage = props.special_damage or {}
weapon.dead = false
--create the bounding box
@@ -129,7 +131,7 @@ function Weapon:collide(node, dt, mtv_x, mtv_y)
if node.hurt then
- node:hurt(self.damage)
+ node:hurt(self.damage, self.special_damage)
if self.player then
self.collider:setGhost(self.bb)
end
diff --git a/src/nodes/weapons/battleaxe.lua b/src/nodes/weapons/battleaxe.lua
index eefa24732..5ab0ed98d 100644
--- a/src/nodes/weapons/battleaxe.lua
+++ b/src/nodes/weapons/battleaxe.lua
@@ -16,6 +16,7 @@ return {
dropWidth = 23,
dropHeight = 44,
damage = 6,
+ special_damage = {slash = 2, axe = 2},
bbox_width = 22,
bbox_height = 25,
bbox_offset_x = {3,28},
diff --git a/src/nodes/weapons/boneclub.lua b/src/nodes/weapons/boneclub.lua
index 031a1b6f8..12ac6dd0a 100644
--- a/src/nodes/weapons/boneclub.lua
+++ b/src/nodes/weapons/boneclub.lua
@@ -15,6 +15,7 @@ return{
dropWidth = 8,
dropHeight = 36,
damage = 2,
+ special_damage = {blunt = 1},
dead = false,
bbox_width = 30,
bbox_height = 30,
diff --git a/src/nodes/weapons/crimson_sword.lua b/src/nodes/weapons/crimson_sword.lua
index 6d4d8fcde..0fda74b7d 100644
--- a/src/nodes/weapons/crimson_sword.lua
+++ b/src/nodes/weapons/crimson_sword.lua
@@ -7,6 +7,7 @@ return{
dropWidth = 9,
dropHeight = 33,
damage = 5,
+ special_damage = {stab = 1, slash = 2},
dead = false,
bbox_width = 30,
bbox_height = 28,
diff --git a/src/nodes/weapons/longsword.lua b/src/nodes/weapons/longsword.lua
index 1c81a52a4..35c862f31 100644
--- a/src/nodes/weapons/longsword.lua
+++ b/src/nodes/weapons/longsword.lua
@@ -15,6 +15,7 @@ return {
dropWidth = 11,
dropHeight = 45,
damage = 3,
+ special_damage = {slash = 2},
bbox_width = 30,
bbox_height = 30,
bbox_offset_x = {2,20},
diff --git a/src/nodes/weapons/mace.lua b/src/nodes/weapons/mace.lua
index e00b10db6..2d43246ad 100644
--- a/src/nodes/weapons/mace.lua
+++ b/src/nodes/weapons/mace.lua
@@ -16,6 +16,7 @@ return {
dropWidth = 24,
dropHeight = 44,
damage = 7,
+ special_damage = {blunt = 2, stab = 1},
bbox_width = 22,
bbox_height = 30,
bbox_offset_x = {0,3,28},
diff --git a/src/nodes/weapons/mallet.lua b/src/nodes/weapons/mallet.lua
index e043cac42..79e295872 100644
--- a/src/nodes/weapons/mallet.lua
+++ b/src/nodes/weapons/mallet.lua
@@ -16,6 +16,7 @@ return{
dropWidth = 11,
dropHeight = 18,
damage = 6,
+ special_damage = {blunt = 2},
bbox_width = 15,
bbox_height = 28,
bbox_offset_x = {0,4,6,4},
diff --git a/src/nodes/weapons/switch.lua b/src/nodes/weapons/switch.lua
index 0c90d20bc..76bead669 100644
--- a/src/nodes/weapons/switch.lua
+++ b/src/nodes/weapons/switch.lua
@@ -15,6 +15,7 @@ return{
dropWidth = 6,
dropHeight = 34,
damage = 2,
+ special_damage = {blunt = 1},
dead = false,
bbox_width = 30,
bbox_height = 28,
diff --git a/src/nodes/weapons/sword.lua b/src/nodes/weapons/sword.lua
index 7cd6baa8d..c9bf4ea64 100644
--- a/src/nodes/weapons/sword.lua
+++ b/src/nodes/weapons/sword.lua
@@ -16,6 +16,7 @@ return{
dropWidth = 9,
dropHeight = 33,
damage = 3,
+ special_damage = {stab = 2},
dead = false,
bbox_width = 30,
bbox_height = 28,
diff --git a/src/nodes/weapons/torch.lua b/src/nodes/weapons/torch.lua
index e73b0281e..529c92d95 100644
--- a/src/nodes/weapons/torch.lua
+++ b/src/nodes/weapons/torch.lua
@@ -16,6 +16,7 @@ return{
dropWidth = 24,
dropHeight = 40,
damage = 2,
+ special_damage = {fire = 3},
bbox_width = 20,
bbox_height = 33,
bbox_offset_x = {3,12,12,12} ,
diff --git a/src/player.lua b/src/player.lua
index 1bf139836..fe08203ea 100644
--- a/src/player.lua
+++ b/src/player.lua
@@ -11,18 +11,8 @@ local Gamestate = require 'vendor/gamestate'
local InputController = require 'inputcontroller'
local app = require 'app'
-local healthbar = love.graphics.newImage('images/healthbar.png')
-healthbar:setFilter('nearest', 'nearest')
-
local Inventory = require('inventory')
-local healthbarq = {}
-
-for i=10,0,-1 do
- table.insert(healthbarq, love.graphics.newQuad(28 * i * 2, 0, 28, 27,
- healthbar:getWidth(), healthbar:getHeight()))
-end
-
local Player = {}
Player.__index = Player
Player.isPlayer = true
@@ -669,22 +659,6 @@ function Player:draw()
return
end
- if self.blink then
- local arrayMax = table.getn(healthbarq)
- -- a player can apparently be damaged by .5 (say from falling), so we need to ensure we're dealing with
- -- integers when accessing the array
- -- also ensure the index is in bounds. (1 to arrayMax)
- local drawHealth = math.floor(self.health) + 1
- if drawHealth > arrayMax then
- drawHealth = arrayMax
- elseif drawHealth < 1 then
- drawHealth = 1
- end
- love.graphics.drawq(healthbar, healthbarq[drawHealth],
- math.floor(self.position.x) - 18,
- math.floor(self.position.y) - 18)
- end
-
if self.flash then
love.graphics.setColor( 255, 0, 0, 255 )
end
diff --git a/src/select.lua b/src/select.lua
index 5d3d40621..48a662159 100644
--- a/src/select.lua
+++ b/src/select.lua
@@ -194,7 +194,8 @@ function state:update(dt)
character.pick(currentPick.name, currentPick.costume)
-- Probably don't need this anymore
- character.changed = true
+ local current = character.current()
+ current.changed = true
love.graphics.setColor(255, 255, 255, 255)
diff --git a/src/splash.lua b/src/splash.lua
index 9af55a829..94512bf6f 100644
--- a/src/splash.lua
+++ b/src/splash.lua
@@ -44,7 +44,7 @@ function splash:enter(a)
tween(4, self.logo_position, { y=self.logo_position_final})
-- sparkles
- self.sparklesprite = love.graphics.newImage('images/cornelius_sparkles.png')
+ self.sparklesprite = love.graphics.newImage('images/cutscenes/cornelius_sparkles.png')
self.bling = anim8.newGrid(24, 24, self.sparklesprite:getWidth(), self.sparklesprite:getHeight())
self.sparkles = {{55,34},{42,112},{132,139},{271,115},{274,50}}
diff --git a/src/test/runner.lua b/src/test/runner.lua
index ca2d5977c..acc22d9e6 100644
--- a/src/test/runner.lua
+++ b/src/test/runner.lua
@@ -11,6 +11,7 @@ lunatest.suite("test/test_cheat")
lunatest.suite("test/test_inventory")
lunatest.suite("test/test_inputcontroller")
lunatest.suite("test/test_character")
+lunatest.suite("test/test_mixpanel")
-- Don't change these lines
love.audio.setVolume(0)
diff --git a/src/test/test_mixpanel.lua b/src/test/test_mixpanel.lua
new file mode 100644
index 000000000..5d87f5770
--- /dev/null
+++ b/src/test/test_mixpanel.lua
@@ -0,0 +1,27 @@
+local mixpanel = require "src/vendor/mixpanel"
+
+--should be -1 for a negative number
+function test_random_id()
+ assert_equal(#mixpanel.randomId(), 10)
+end
+
+function test_distinct_id()
+ love.filesystem.remove('mixpanel.txt')
+ assert_equal(mixpanel.distinctId(), mixpanel.distinctId())
+end
+
+function test_distinct_id_len()
+ love.filesystem.remove('mixpanel.txt')
+ assert_equal(#mixpanel.distinctId(), 10)
+end
+
+function test_distinct_id_source()
+ love.filesystem.write('mixpanel.txt', 'foo')
+ assert_equal(mixpanel.distinctId(), 'foo')
+ love.filesystem.remove('mixpanel.txt')
+end
+
+
+function test_randomness()
+ assert_not_equal(mixpanel.randomId(), mixpanel.randomId())
+end
diff --git a/src/vendor/gamestate.lua b/src/vendor/gamestate.lua
index f2bb2c7ce..cf3b44adf 100644
--- a/src/vendor/gamestate.lua
+++ b/src/vendor/gamestate.lua
@@ -23,6 +23,8 @@ LIABILITY, WHETHER IN AN ATTACK OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
]]--
+local mixpanel = require 'vendor/mixpanel'
+
local function __NULL__() end
-- default gamestate produces error on every callback
@@ -67,6 +69,8 @@ function GS.switch(to, ...)
assert(to, "Missing argument: Gamestate to switch to")
if type(to) == "string" then
+ mixpanel.track('scene.changed', {scene = to})
+
local name = to
to = GS.get(to)
assert(to, "Failed loading gamestate " .. name)
diff --git a/src/vendor/mixpanel.lua b/src/vendor/mixpanel.lua
index 93cd97e5d..c9649e896 100644
--- a/src/vendor/mixpanel.lua
+++ b/src/vendor/mixpanel.lua
@@ -4,6 +4,41 @@ local mixpanel = {}
local thread = nil
local version = nil
+local char = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
+"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
+"w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6"}
+
+
+math.randomseed(os.time())
+
+-- Generate a 10-digit random ID
+function mixpanel.distinctId()
+ if not love.filesystem.exists('mixpanel.txt') then
+ love.filesystem.write('mixpanel.txt', mixpanel.randomId())
+ end
+
+ local contents, _ = love.filesystem.read('mixpanel.txt')
+ return contents
+end
+
+-- Generate a 10-digit random ID
+function mixpanel.randomId()
+ local size = 10
+ local pass = {}
+
+ for z = 1,size do
+ local case = math.random(1,2)
+ local a = math.random(1,#char)
+ if case == 1 then
+ x=string.upper(char[a])
+ elseif case == 2 then
+ x=string.lower(char[a])
+ end
+ table.insert(pass, x)
+ end
+ return(table.concat(pass))
+end
+
function mixpanel.init(v)
thread = love.thread.newThread("mixpanel", "vendor/mixpanel_thread.lua")
thread:start()
@@ -18,7 +53,8 @@ function mixpanel.track(event, data)
data["version"] = version
data["os"] = love._os
-
+ data["distinct_id"] = mixpanel.distinctId()
+
local payload = {
["metrics"] = {
{ ["event"] = event, ["properties"] = data },
diff --git a/src/vendor/mixpanel_thread.lua b/src/vendor/mixpanel_thread.lua
index 8921393bf..b3768956c 100644
--- a/src/vendor/mixpanel_thread.lua
+++ b/src/vendor/mixpanel_thread.lua
@@ -6,7 +6,7 @@ local thread = love.thread.getThread()
while true do
local payload = thread:demand("payload")
- return http.request {
+ http.request {
method = "POST",
url = baseurl .. "/metrics",
headers = { ["content-type"] = "application/json", ["content-length"] = tostring(payload:len()) },
diff --git a/templates/post.md b/templates/post.md
index 3013b1389..8a20ae4b6 100644
--- a/templates/post.md
+++ b/templates/post.md
@@ -2,9 +2,9 @@
**DOWNLOAD**
-- [OS X](http://files.projecthawkthorne.com/releases/latest/hawkthorne-osx.zip)
-- [Windows](http://files.projecthawkthorne.com/releases/latest/hawkthorne-win-x86.zip)
-- [hawkthorne.love](http://files.projecthawkthorne.com/releases/latest/hawkthorne.love)
+- [OS X](http://files.projecthawkthorne.com/releases/v{{version}}/hawkthorne-osx.zip)
+- [Windows](http://files.projecthawkthorne.com/releases/v{{version}}/hawkthorne-win-x86.zip)
+- [hawkthorne.love](http://files.projecthawkthorne.com/releases/v{{version}}/hawkthorne.love)
You'll need to install the [love](http://love2d.org) framework as well.
**How can I help?**