Compare commits

..

No commits in common. "18d9d681b89619d162fe373d093050326247d430" and "e764082a804bdf1aaa3a43db698b68631cb9264d" have entirely different histories.

4 changed files with 9 additions and 53 deletions

View file

@ -91,17 +91,6 @@ function love.draw()
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.print('FPS: ' .. 1 / love.timer.getDelta(), 0, sh - 16) love.graphics.print('FPS: ' .. 1 / love.timer.getDelta(), 0, sh - 16)
if paused then
love.graphics.setBlendMode('subtract')
love.graphics.setColor(1, 1, 1, 0.1)
love.graphics.rectangle('fill', 0, 0, sw, sh)
love.graphics.setBlendMode('alpha')
love.graphics.setColor(0, 0, 0, 0.6)
love.graphics.rectangle('fill', 0, 0, sw, sh)
love.graphics.setColor(1, 1, 1)
love.graphics.print('paused, space to unpause', 20, 20)
end
if debug then bench.renderBenchmark() end if debug then bench.renderBenchmark() end
bench.stopBenchmark('render') bench.stopBenchmark('render')
end end
@ -117,7 +106,5 @@ end
function love.keypressed(key) function love.keypressed(key)
if key == 'f3' then if key == 'f3' then
debug = not debug debug = not debug
elseif key == 'space' then
paused = false
end end
end end

View file

@ -14,7 +14,7 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyf
local x = 19 local x = 19
local y = 3 local y = 3
for b = 1, 7 do for b = 1, 7 do
local hovered = mouseOverBox(x * size, y * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size) and not paused local hovered = mouseOverBox(x * size, y * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size)
local btn = headerbuttons[b] local btn = headerbuttons[b]
if (btn and not btn.open) or not btn then if (btn and not btn.open) or not btn then
@ -35,8 +35,8 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyf
end end
tooltipText = btn.tooltipText tooltipText = btn.tooltipText
tooltipx = x * size + sprites['header/buttonbg']:getWidth() * size * 0.5 - tooltipText:getWidth()/2 tooltipx = x + sprites['header/buttonbg']:getWidth() * size * 0.5 - tooltipText:getWidth()/2
tooltipy = y * size + sprites['header/buttonbg']:getWidth() * size tooltipy = y + sprites['header/buttonbg']:getWidth() * size
end end
if btn then if btn then
@ -106,16 +106,6 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyf
x = x + incr x = x + incr
end end
-- options text
local s = sprites['header/optionsbutton_hover']
local hovered = mouseOverBox(sw - 115 * size, size * (HEADER_HEIGHT - 65), s:getWidth() * size, s:getHeight() * size) and not paused
if hovered and love.mouse.isDown(1) then
love.graphics.draw(sprites['header/optionsbutton_down'], sw - 115 * size, size * (HEADER_HEIGHT - 65), 0, size, size)
elseif hovered then
love.graphics.draw(sprites['header/optionsbutton_hover'], sw - 115 * size, size * (HEADER_HEIGHT - 65), 0, size, size)
end
-- money count -- money count
if love.timer.getTime() % 0.25 < 0.125 and moneyflashtimer > 0 then love.graphics.draw(sprites['header/moneyflash'], sw * 0.851, (HEADER_HEIGHT - 29) * size, 0, size, size) end if love.timer.getTime() % 0.25 < 0.125 and moneyflashtimer > 0 then love.graphics.draw(sprites['header/moneyflash'], sw * 0.851, (HEADER_HEIGHT - 29) * size, 0, size, size) end
love.graphics.setFont(fonts.continuum) love.graphics.setFont(fonts.continuum)
@ -124,7 +114,7 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyf
love.graphics.printf(balance, round(sw * 0.965 - leftpad), round((HEADER_HEIGHT - 25) * size), leftpad, 'right') love.graphics.printf(balance, round(sw * 0.965 - leftpad), round((HEADER_HEIGHT - 25) * size), leftpad, 'right')
-- tooltips -- tooltips
if tooltipText and not paused then if tooltipText then
love.graphics.setColor(254/255, 254/255, 199/255) love.graphics.setColor(254/255, 254/255, 199/255)
love.graphics.rectangle('fill', round(tooltipx - 5), round(tooltipy - 5), round(tooltipText:getWidth() + 10), round(tooltipText:getHeight() + 10)) love.graphics.rectangle('fill', round(tooltipx - 5), round(tooltipy - 5), round(tooltipText:getWidth() + 10), round(tooltipText:getHeight() + 10))
love.graphics.setColor(2/255, 2/255, 2/255) love.graphics.setColor(2/255, 2/255, 2/255)

View file

@ -82,7 +82,7 @@ local headerbuttons = {
sprite = 'starpotion', sprite = 'starpotion',
tooltip = 'buy star potion', tooltip = 'buy star potion',
openanim = 1, openanim = 1,
open = false, open = true,
closed = false, closed = false,
func = function() func = function()
starpotionequipped = true starpotionequipped = true
@ -91,7 +91,6 @@ local headerbuttons = {
} }
local sheets = {} local sheets = {}
paused = false
local function fishsprite(size, hungry, anim) local function fishsprite(size, hungry, anim)
-- anim is turn, swim, eat or die -- anim is turn, swim, eat or die
@ -125,8 +124,6 @@ function self.load()
end end
function self.update(dt) function self.update(dt)
if paused then dt = 0 end
bench.startBenchmark('update_buttons') bench.startBenchmark('update_buttons')
moneyflashtimer = moneyflashtimer - dt moneyflashtimer = moneyflashtimer - dt
@ -138,7 +135,7 @@ function self.update(dt)
local size = (love.graphics.getWidth()/640) local size = (love.graphics.getWidth()/640)
local hovered = mouseOverBox(x * size, y * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size) local hovered = mouseOverBox(x * size, y * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size)
if btn.open and hovered and not paused then if btn.open and hovered then
setCursor(cursors.hover) setCursor(cursors.hover)
end end
@ -148,13 +145,6 @@ function self.update(dt)
x = x + incr x = x + incr
end end
local s = sprites['header/optionsbutton_hover']
local size = love.graphics.getWidth() / 640
local hovered = mouseOverBox(love.graphics.getWidth() - 115 * size, size * (HEADER_HEIGHT - 65), s:getWidth() * size, s:getHeight() * size)
if hovered and not paused then
setCursor(cursors.hover)
end
bench.stopBenchmark('update_buttons') bench.stopBenchmark('update_buttons')
bench.startBenchmark('update_food') bench.startBenchmark('update_food')
@ -218,14 +208,7 @@ function self.draw()
end end
function self.mousepressed(x, y, b) function self.mousepressed(x, y, b)
if b == 1 and not paused then if b == 1 then
local s = sprites['header/optionsbutton_hover']
local size = love.graphics.getWidth() / 640
local hovered = mouseOverBox(love.graphics.getWidth() - 115 * size, size * (HEADER_HEIGHT - 65), s:getWidth() * size, s:getHeight() * size)
if hovered then
paused = true
end
for _,m in ipairs(money) do for _,m in ipairs(money) do
local dist = math.abs(x - m.x * love.graphics.getWidth()) + math.abs(y - m.y * love.graphics.getHeight()) local dist = math.abs(x - m.x * love.graphics.getWidth()) + math.abs(y - m.y * love.graphics.getHeight())
if dist < sheets.coin1.width/2 and not m.collected then if dist < sheets.coin1.width/2 and not m.collected then
@ -244,7 +227,7 @@ function self.mousepressed(x, y, b)
end end
end end
if b == 1 and y > HEADER_HEIGHT and not paused then if b == 1 and y > HEADER_HEIGHT then
if starpotionequipped then if starpotionequipped then
table.insert(food, constr.food(x/love.graphics.getWidth(), y/love.graphics.getHeight(), 4)) table.insert(food, constr.food(x/love.graphics.getWidth(), y/love.graphics.getHeight(), 4))
playSound('dropfood') playSound('dropfood')
@ -266,7 +249,7 @@ function self.mousepressed(x, y, b)
local headerheight = HEADER_HEIGHT * love.graphics.getWidth()/640 local headerheight = HEADER_HEIGHT * love.graphics.getWidth()/640
local size = headerheight / HEADER_HEIGHT local size = headerheight / HEADER_HEIGHT
if b == 1 and not paused then if b == 1 then
local x = 19 local x = 19
for i = 1, 7 do for i = 1, 7 do
local hovered = mouseOverBox(x * size, 3 * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size) local hovered = mouseOverBox(x * size, 3 * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size)

View file

@ -212,10 +212,6 @@ return function(feesh, dt, food, headerbuttons, money)
headerbuttons[4].open = true headerbuttons[4].open = true
headerbuttons[4].openanim = 0 headerbuttons[4].openanim = 0
end end
if not headerbuttons[5].open and not headerbuttons[5].closed then
headerbuttons[5].open = true
headerbuttons[5].openanim = 0
end
end end
if n.lifetime > FISH_AGE_KING and n.size == 2 then if n.lifetime > FISH_AGE_KING and n.size == 2 then
n.size = 3 n.size = 3