Skip to content

Commit

Permalink
Merge pull request #2212 from hawkthorne/master
Browse files Browse the repository at this point in the history
RELEASE Journey to the Center of Hawkthorne v0.10.1
  • Loading branch information
niamu committed Sep 14, 2014
2 parents f24ef98 + f36f5ab commit e07edff
Show file tree
Hide file tree
Showing 16 changed files with 107 additions and 48 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@ src/positions/%.lua: psds/positions/%.png

win32/love.exe:
$(wget) https://bitbucket.org/rude/love/downloads/love-0.9.1-win32.zip
unzip love-0.9.1-win32.zip
unzip -q love-0.9.1-win32.zip
mv love-0.9.1-win32 win32
rm -f love-0.9.1-win32.zip
rm win32/changes.txt win32/game.ico win32/license.txt win32/love.ico win32/readme.txt

win32/hawkthorne.exe: build/hawkthorne.love win32/love.exe
cat win32/love.exe build/hawkthorne.love > win32/hawkthorne.exe
Expand Down
File renamed without changes
15 changes: 10 additions & 5 deletions src/inventory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,9 @@ function Inventory:draw( playerPosition )
item = self.pages[self.currentPageName][slotIndex]
elseif self.cursorPos.x == 2 and self.currentIngredients.a and self.currentIngredients.b then
local result = self:findResult(self.currentIngredients.a, self.currentIngredients.b)
item = require ('items/' .. result.type .. 's/' .. result.name)
if result then
item = require ('items/' .. result.type .. 's/' .. result.name)
end
elseif self.cursorPos.x == 3 and self.currentIngredients.a then
item = require ('items/' .. self.currentIngredients.a.type .. 's/' .. self.currentIngredients.a.name)
elseif self.cursorPos.x == 4 and self.currentIngredients.b then
Expand Down Expand Up @@ -684,15 +686,14 @@ end
function Inventory:addItem(item, sfx, callback)
local pageName = item.type .. 's'
assert(self.pages[pageName], "Bad Item type! " .. item.type .. " is not a valid item type.")

if callback then
callback()
end

if self:tryMerge(item) then
if sfx ~= false then
sound.playSfx('pickup')
end
if callback then
callback()
end
return true --If we had a complete successful merge with no remainders, there is no reason to add the item.
end
local slot = self:nextAvailableSlot(pageName)
Expand All @@ -708,6 +709,10 @@ function Inventory:addItem(item, sfx, callback)
end

self:changeItem()

if callback then
callback()
end

return true
end
Expand Down
1 change: 1 addition & 0 deletions src/level.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ function Level:update(dt)
self.player:saveData( gamesave )
self.over = true
self.respawn = Timer.add(3, function()
self.player:resetEffects()
self.player.character:reset()
local point = gamesave:get('savepoint', {level='studyroom', name='bookshelf'})
if app.config.hardcore then
Expand Down
2 changes: 0 additions & 2 deletions src/maps/blacksmith.tmx
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,12 @@
<properties>
<property name="persistent" value="true"/>
<property name="direction" value="left"/>
<property name="directory" value="weapons/"/>
</properties>
</object>
<object name="throwingtorch" type="projectile" x="480" y="144" width="24" height="48">
<properties>
<property name="persistent" value="true"/>
<property name="direction" value="left"/>
<property name="directory" value="weapons/"/>
</properties>
</object>
<object name="axe" type="weapon" x="384" y="144" width="24" height="24">
Expand Down
18 changes: 15 additions & 3 deletions src/maps/treeline.tmx
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,20 @@
<property name="sprite" value="note"/>
</properties>
</object>
<object name="flowers" type="material" x="1368" y="504" width="24" height="24"/>
<object name="flowers" type="material" x="1800" y="504" width="24" height="24"/>
<object name="flowers" type="material" x="1944" y="264" width="24" height="24"/>
<object name="flowers" type="material" x="1368" y="504" width="24" height="24">
<properties>
<property name="persistent" value="true"/>
</properties>
</object>
<object name="flowers" type="material" x="1800" y="504" width="24" height="24">
<properties>
<property name="persistent" value="true"/>
</properties>
</object>
<object name="flowers" type="material" x="1944" y="264" width="24" height="24">
<properties>
<property name="persistent" value="true"/>
</properties>
</object>
</objectgroup>
</map>
5 changes: 3 additions & 2 deletions src/nodes/key.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function Key.new(node, collider)
local key = {}
setmetatable(key, Key)
key.name = node.name
key.type = node.type
key.image = love.graphics.newImage('images/keys/'..node.name..'.png')
key.image_q = love.graphics.newQuad( 0, 0, 24, 24, key.image:getWidth(),key.image:getHeight() )
key.foreground = node.properties.foreground
Expand Down Expand Up @@ -53,8 +54,8 @@ function Key:keypressed( button, player )
local item = Item.new(itemNode, self.quantity)

if player.inventory:hasKey(self.name) or player.inventory:addItem(item) then
self.containerLevel:saveRemovedNode(self)
self.containerLevel:removeNode(self)

end

local message = self.info or {'You found the "'..item.description..'" key!'}
Expand All @@ -68,7 +69,7 @@ function Key:keypressed( button, player )
local options = {'Exit'}
player.freeze = true
player.invulnerable = true
self.position = { x = player.position.x +10 ,y = player.position.y - 10}
self.position = { x = player.position.x + 10, y = player.position.y - 10 }
self.prompt = Prompt.new(message, callback, options, self)
end

Expand Down
3 changes: 2 additions & 1 deletion src/nodes/projectile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function Projectile.new(node, collider)
proj.props = utils.require( 'nodes/projectiles/' .. name )
proj.directory = node.directory

local dir = node.directory or ""
-- projectile images are stored in weapons, need to specify here
local dir = "weapons/"
-- Checking properties for when projectile is spawned in tiled
if node.properties then
dir = node.properties.directory or dir
Expand Down
3 changes: 2 additions & 1 deletion src/npcs/blacksmith.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ local Timer = require 'vendor/timer'
local sound = require 'vendor/TEsound'
local Gamestate = require 'vendor/gamestate'
local sound = require 'vendor/TEsound'
local controls = require('inputcontroller').get()
local NodeClass = require('nodes/npc')

return {
Expand Down Expand Up @@ -72,7 +73,7 @@ return {
talk_responses = {
["inventory"]={
"These are my wares.",
"Press the Interact button to view item information.",
"Press {{yellow}}".. string.upper(controls:getKey('INTERACT')) .."{{white}} to view item information.",
},
["Hello!"]={
"Hello, I am the blacksmith.",
Expand Down
3 changes: 2 additions & 1 deletion src/npcs/blacksmithjuan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
local Prompt = require 'prompt'
local Timer = require 'vendor/timer'
local sound = require 'vendor/TEsound'
local controls = require('inputcontroller').get()
local Gamestate = require 'vendor/gamestate'

return {
Expand All @@ -23,7 +24,7 @@ return {
talk_responses = {
["inventory"]={
"These are my *hiccup* wares.",
"Press the Interact button to view item information.",
"Press {{yellow}}".. string.upper(controls:getKey('INTERACT')) .."{{white}} to view item information.",
},
["Hello!"]={
"Hello, *hiccup* I am Juans *hiccup* Smithy.",
Expand Down
3 changes: 2 additions & 1 deletion src/npcs/hilda.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ local utils = require 'utils'
local anim8 = require 'vendor/anim8'
local Dialog = require 'dialog'
local prompt = require 'prompt'
local controls = require('inputcontroller').get()
local Emotion = require 'nodes/emotion'

return {
Expand Down Expand Up @@ -713,7 +714,7 @@ return {
npc.prompt = prompt.new("Do you want to learn to kickpunch?", function(result)
if result == 'Yes' then
player.canSlideAttack = true
Dialog.new("To kickpunch run forward then press DOWN then ATTACK.", function()
Dialog.new("To kickpunch run forward then press {{yellow}}".. string.upper(controls:getKey('DOWN')) .."{{white}} then {{yellow}}".. string.upper(controls:getKey('ATTACK')) .."{{white}}.", function()
Dialog.currentDialog = nil
npc.menu:close(player)
end)
Expand Down
3 changes: 2 additions & 1 deletion src/npcs/leslie.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
local Prompt = require 'prompt'
local Timer = require 'vendor/timer'
local sound = require 'vendor/TEsound'
local controls = require('inputcontroller').get()
local Gamestate = require 'vendor/gamestate'

return {
Expand All @@ -26,7 +27,7 @@ return {
talk_responses = {
["inventory"]={
"These are my wares. I crawled through dense bush to get 'em!",
"Press the Interact button to view item information.",
"Press {{yellow}}".. string.upper(controls:getKey('INTERACT')) .."{{white}} to view item information.",
},
["Hello!"]={
"Hello! I'm {{red_light}}Leslie{{white}}, a travelling Sales-bian from the {{olive}}Plaid Plateau{{white}}.",
Expand Down
3 changes: 2 additions & 1 deletion src/npcs/notstarburns.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local Prompt = require 'prompt'
local Timer = require 'vendor/timer'
local sound = require 'vendor/TEsound'
local controls = require('inputcontroller').get()
local Gamestate = require 'vendor/gamestate'

return {
Expand All @@ -27,7 +28,7 @@ return {
talk_responses = {
["inventory"]={
"What'cha need?",
"Press the Interact button to view item information if ya feel like it.",
"Press {{yellow}}".. string.upper(controls:getKey('INTERACT')) .."{{white}} to view item information if ya feel like it.",
},
["Anybody here?"]={
"...Who wants to know?",
Expand Down
45 changes: 44 additions & 1 deletion src/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,53 @@ function Player:hurt(damage)
self:startBlink()
end

function Player:addEffectsTimer(timer)
self.timers = self.timers or {}
self.timers[#self.timers+1] = timer
end

function Player:initEffectsReset()
if not self.resetPlayerEffects then
self.resetValues = {
punchDamage = self.punchDamage,
jumpFactor = self.jumpFactor,
jumpDamage = self.jumpDamage,
slideDamage = self.slideDamage,
speedFactor = self.speedFactor,
costume = self.character.costume
}

self.resetPlayerEffects = function ()
self.punchDamage = self.resetValues.punchDamage
self.jumpFactor = self.resetValues.jumpFactor
self.jumpDamage = self.resetValues.jumpDamage
self.slideDamage = self.resetValues.slideDamage
self.speedFactor = self.resetValues.speedFactor
self.character.costume = self.resetValues.costume
end
end

return self.resetValues.punchDamage,
self.resetValues.jumpFactor,
self.resetValues.jumpDamage,
self.resetValues.slideDamage,
self.resetValues.speedFactor,
self.resetValues.costume
end

function Player:resetEffects()
if self.resetPlayerEffects then
self.resetPlayerEffects()
end
for _,timer in pairs(self.timers) do
Timer.cancel(timer)
end
end

function Player:potionFlash(duration,color)
self:stopBlink()
self.color = color
self.potion = true
self.potion = true

Timer.add(duration, function()
self.potion = false
Expand Down
45 changes: 18 additions & 27 deletions src/playerEffects.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,60 +61,51 @@ function PlayerEffects:randEffect(player, effects)
end

function PlayerEffects.zombie(player)
local punchDamage = player.punchDamage
local jumpDamage = player.jumpDamage
local slideDamage = player.slideDamage
local costume = player.character.costume
Timer.add(66, function () --Resets damage boost and costume after one minute being active
local punchDamage, jumpFactor, jumpDamage, slideDamage, speedFactor, costume = player:initEffectsReset()

player:addEffectsTimer(Timer.add(66, function () --Resets damage boost and costume after one minute being active
HUDMessage("a chilling gust of AC makes you forget your hunger for brains", player, 10)
player.punchDamage = punchDamage
player.jumpDamage = jumpDamage
player.slideDamage = slideDamage
player.character.costume = costume
end)
player.resetPlayerEffects()
end))
HUDMessage("that taco meat tastes weird...", player)
for i=1,2 do
Timer.add(2*i-1, function () -- Damage over time
player:addEffectsTimer(Timer.add(2*i-1, function () -- Damage over time
if player.health > 1 then player:hurt(15) end
end)
end))
end
Timer.add(6, function () -- Set costume to zombie and double unarmed player damage.
player:addEffectsTimer(Timer.add(6, function () -- Set costume to zombie and double unarmed player damage.
if love.filesystem.exists("images/characters/" .. player.character.name .. "/zombie.png") then
player.character.costume = 'zombie'
end
HUDMessage("holy crap, you are a zombie!", player, 10)
player.jumpDamage = player.jumpDamage * 2
player.punchDamage = player.punchDamage * 2
player.slideDamage = player.slideDamage * 2
end)
player.jumpDamage = jumpDamage * 2
player.punchDamage = punchDamage * 2
player.slideDamage = slideDamage * 2
end))
end

function PlayerEffects.dudEffect(item, player)
HUDMessage("that " .. item .. " got stale and lost its power", player, 10)
end

function PlayerEffects.alcohol(player)
local punchDamage = player.punchDamage
local jumpFactor = player.jumpFactor
local speedFactor = player.speedFactor
local punchDamage, jumpFactor, jumpDamage, slideDamage, speedFactor, costume = player:initEffectsReset()

Timer.add(40, function () --Resets everything
player:addEffectsTimer(Timer.add(40, function () --Resets everything
HUDMessage("Sobering up", player)
player.punchDamage = punchDamage
player.jumpFactor = jumpFactor
player.speedFactor = speedFactor
end)
player.resetPlayerEffects()
end))

HUDMessage("I think you drank too much...", player)
player.jumpFactor = jumpFactor * (math.random(40, 80) / 100)
player.punchDamage = punchDamage * (math.random(40, 80) / 100)
player.speedFactor = speedFactor * (math.random(40, 80) / 100)

Timer.addPeriodic(10, function()
player:addEffectsTimer(Timer.addPeriodic(10, function()
player.jumpFactor = jumpFactor * (math.random(40, 80) / 100)
player.punchDamage = punchDamage * (math.random(40, 80) / 100)
player.speedFactor = speedFactor * (math.random(40, 80) / 100)
end, 3)
end, 3))

end

Expand Down
3 changes: 2 additions & 1 deletion src/shopping.lua
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ function state:buySelectedItem()
local cost = itemInfo[3]
local item = itemInfo.item

self:tooltipClose()

if self.player.money < cost*self.buyAmount then
self.message = "You don't have enough money to make this purchase."
Expand Down Expand Up @@ -375,7 +376,6 @@ function state:buySelectedItem()
self.window = "messageWindow"
end


end


Expand All @@ -389,6 +389,7 @@ function state:sellSelectedItem()

local playerItem, pageIndex, slotIndex = self.player.inventory:search(item)

self:tooltipClose()

if iamount <= 0 or not playerItem then
self.message = "You don't have any of these to sell."
Expand Down

0 comments on commit e07edff

Please sign in to comment.