Compare commits
No commits in common. "18d9d681b89619d162fe373d093050326247d430" and "e764082a804bdf1aaa3a43db698b68631cb9264d" have entirely different histories.
18d9d681b8
...
e764082a80
4 changed files with 9 additions and 53 deletions
13
main.lua
13
main.lua
|
@ -91,17 +91,6 @@ function love.draw()
|
|||
love.graphics.setColor(1, 1, 1, 1)
|
||||
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
|
||||
bench.stopBenchmark('render')
|
||||
end
|
||||
|
@ -117,7 +106,5 @@ end
|
|||
function love.keypressed(key)
|
||||
if key == 'f3' then
|
||||
debug = not debug
|
||||
elseif key == 'space' then
|
||||
paused = false
|
||||
end
|
||||
end
|
|
@ -14,7 +14,7 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyf
|
|||
local x = 19
|
||||
local y = 3
|
||||
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]
|
||||
|
||||
if (btn and not btn.open) or not btn then
|
||||
|
@ -35,8 +35,8 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyf
|
|||
end
|
||||
|
||||
tooltipText = btn.tooltipText
|
||||
tooltipx = x * size + sprites['header/buttonbg']:getWidth() * size * 0.5 - tooltipText:getWidth()/2
|
||||
tooltipy = y * size + sprites['header/buttonbg']:getWidth() * size
|
||||
tooltipx = x + sprites['header/buttonbg']:getWidth() * size * 0.5 - tooltipText:getWidth()/2
|
||||
tooltipy = y + sprites['header/buttonbg']:getWidth() * size
|
||||
end
|
||||
|
||||
if btn then
|
||||
|
@ -106,16 +106,6 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyf
|
|||
x = x + incr
|
||||
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
|
||||
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)
|
||||
|
@ -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')
|
||||
|
||||
-- tooltips
|
||||
if tooltipText and not paused then
|
||||
if tooltipText then
|
||||
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.setColor(2/255, 2/255, 2/255)
|
||||
|
|
|
@ -82,7 +82,7 @@ local headerbuttons = {
|
|||
sprite = 'starpotion',
|
||||
tooltip = 'buy star potion',
|
||||
openanim = 1,
|
||||
open = false,
|
||||
open = true,
|
||||
closed = false,
|
||||
func = function()
|
||||
starpotionequipped = true
|
||||
|
@ -91,7 +91,6 @@ local headerbuttons = {
|
|||
}
|
||||
|
||||
local sheets = {}
|
||||
paused = false
|
||||
|
||||
local function fishsprite(size, hungry, anim)
|
||||
-- anim is turn, swim, eat or die
|
||||
|
@ -125,8 +124,6 @@ function self.load()
|
|||
end
|
||||
|
||||
function self.update(dt)
|
||||
if paused then dt = 0 end
|
||||
|
||||
bench.startBenchmark('update_buttons')
|
||||
|
||||
moneyflashtimer = moneyflashtimer - dt
|
||||
|
@ -138,7 +135,7 @@ function self.update(dt)
|
|||
local size = (love.graphics.getWidth()/640)
|
||||
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)
|
||||
end
|
||||
|
||||
|
@ -148,13 +145,6 @@ function self.update(dt)
|
|||
x = x + incr
|
||||
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.startBenchmark('update_food')
|
||||
|
@ -218,14 +208,7 @@ function self.draw()
|
|||
end
|
||||
|
||||
function self.mousepressed(x, y, b)
|
||||
if b == 1 and not paused 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
|
||||
|
||||
if b == 1 then
|
||||
for _,m in ipairs(money) do
|
||||
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
|
||||
|
@ -244,7 +227,7 @@ function self.mousepressed(x, y, b)
|
|||
end
|
||||
end
|
||||
|
||||
if b == 1 and y > HEADER_HEIGHT and not paused then
|
||||
if b == 1 and y > HEADER_HEIGHT then
|
||||
if starpotionequipped then
|
||||
table.insert(food, constr.food(x/love.graphics.getWidth(), y/love.graphics.getHeight(), 4))
|
||||
playSound('dropfood')
|
||||
|
@ -266,7 +249,7 @@ function self.mousepressed(x, y, b)
|
|||
local headerheight = HEADER_HEIGHT * love.graphics.getWidth()/640
|
||||
local size = headerheight / HEADER_HEIGHT
|
||||
|
||||
if b == 1 and not paused then
|
||||
if b == 1 then
|
||||
local x = 19
|
||||
for i = 1, 7 do
|
||||
local hovered = mouseOverBox(x * size, 3 * size, sprites['header/buttonbg']:getWidth() * size, sprites['header/buttonbg']:getHeight() * size)
|
||||
|
|
|
@ -212,10 +212,6 @@ return function(feesh, dt, food, headerbuttons, money)
|
|||
headerbuttons[4].open = true
|
||||
headerbuttons[4].openanim = 0
|
||||
end
|
||||
if not headerbuttons[5].open and not headerbuttons[5].closed then
|
||||
headerbuttons[5].open = true
|
||||
headerbuttons[5].openanim = 0
|
||||
end
|
||||
end
|
||||
if n.lifetime > FISH_AGE_KING and n.size == 2 then
|
||||
n.size = 3
|
||||
|
|
Loading…
Reference in a new issue