diff --git a/assets/audio/sfx/chomp.ogg b/assets/audio/sfx/chomp.ogg deleted file mode 100644 index e10f11f..0000000 Binary files a/assets/audio/sfx/chomp.ogg and /dev/null differ diff --git a/assets/sprites/fish/carnivore_die.png b/assets/sprites/fish/biig_die.png similarity index 100% rename from assets/sprites/fish/carnivore_die.png rename to assets/sprites/fish/biig_die.png diff --git a/assets/sprites/fish/carnivore_eat.png b/assets/sprites/fish/biig_eat.png similarity index 100% rename from assets/sprites/fish/carnivore_eat.png rename to assets/sprites/fish/biig_eat.png diff --git a/assets/sprites/fish/carnivore_hungry_eat.png b/assets/sprites/fish/biig_hungry_eat.png similarity index 100% rename from assets/sprites/fish/carnivore_hungry_eat.png rename to assets/sprites/fish/biig_hungry_eat.png diff --git a/assets/sprites/fish/carnivore_hungry_swim.png b/assets/sprites/fish/biig_hungry_swim.png similarity index 100% rename from assets/sprites/fish/carnivore_hungry_swim.png rename to assets/sprites/fish/biig_hungry_swim.png diff --git a/assets/sprites/fish/carnivore_hungry_turn.png b/assets/sprites/fish/biig_hungry_turn.png similarity index 100% rename from assets/sprites/fish/carnivore_hungry_turn.png rename to assets/sprites/fish/biig_hungry_turn.png diff --git a/assets/sprites/fish/carnivore_swim.png b/assets/sprites/fish/biig_swim.png similarity index 100% rename from assets/sprites/fish/carnivore_swim.png rename to assets/sprites/fish/biig_swim.png diff --git a/assets/sprites/fish/carnivore_turn.png b/assets/sprites/fish/biig_turn.png similarity index 100% rename from assets/sprites/fish/carnivore_turn.png rename to assets/sprites/fish/biig_turn.png diff --git a/const.lua b/const.lua index 8a437fb..2ef8900 100644 --- a/const.lua +++ b/const.lua @@ -20,7 +20,6 @@ FISH_FOOD_DEAD = -13 FISH_AGE_MEDIUM = 25 -- the age, in seconds, needed for a guppy to become a medium guppy FISH_AGE_BIG = 65 -- see above, but for big -FISH_AGE_KING = 15 * 60 -- see above, but for king (15 minutes) FISH_SIZE = 6 -- how many large guppies can you fit on the screen diff --git a/constructors.lua b/constructors.lua index c1f5077..dd86f5a 100644 --- a/constructors.lua +++ b/constructors.lua @@ -2,12 +2,11 @@ require 'const' local self = {} -function self.fish(x, y, type) - type = type or 0 +function self.fish(x, y) local fish = { x = x, y = y, - size = type, -- 0 for small, 1 for medium, 2 for big, 3 for king, 4 for carnivore + size = 0, -- 0 for small, 1 for medium, 2 for big, 3 for king eattimer = 0 + math.random() * 2, -- starts out hungry, with a 2s delay moneytimer = 10 + math.random() * 5, -- min 10s before it can make money dead = false, diff --git a/scenes/gameplay/draw/fish.lua b/scenes/gameplay/draw/fish.lua index 7e2ef5e..0fa4f89 100644 --- a/scenes/gameplay/draw/fish.lua +++ b/scenes/gameplay/draw/fish.lua @@ -57,8 +57,6 @@ return function(feesh, spritescale, fishsprite) size = 'big' elseif n.size == 3 then size = 'king' - elseif n.size == 4 then - size = 'carnivore' end local sheet = fishsprite(size, false, anim) diff --git a/scenes/gameplay/draw/header.lua b/scenes/gameplay/draw/header.lua index 8449f86..0f9dea1 100644 --- a/scenes/gameplay/draw/header.lua +++ b/scenes/gameplay/draw/header.lua @@ -25,11 +25,10 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance) if btn then if btn.open then -- sprite inside - if btn.sprite == 'guppy' or btn.sprite == 'carnivore' then - local sheet = fishsprite(btn.sprite == 'carnivore' and 'carnivore' or 'medium', false, 'swim') + if btn.sprite == 'guppy' then + local sheet = fishsprite('medium', false, 'swim') local frame = math.floor((love.timer.getTime() * 2) % 1 * #sheet.quads) + 1 local scale = (sprites['header/buttonbg']:getWidth() / sheet.width) * 0.9 - if btn.sprite == 'carnivore' then scale = scale * 0.7 end local offset = (sprites['header/buttonbg']:getWidth() * size) / 2 love.graphics.draw(sheet.spriteSheet, sheet.quads[frame], x * size + offset, y * size + offset*0.75, 0, size * scale, size * scale, sheet.width/2, sheet.width/2) elseif btn.sprite == 'food' then diff --git a/scenes/gameplay/draw/money.lua b/scenes/gameplay/draw/money.lua index 1531533..17ee213 100644 --- a/scenes/gameplay/draw/money.lua +++ b/scenes/gameplay/draw/money.lua @@ -1,11 +1,7 @@ -local moneysheets = { - 'coin1', 'coin2', 'star', 'diamond', 'chest' -} - return function(money, sheets, spritescale) local sw, sh = love.graphics.getDimensions() for _,f in ipairs(money) do - local sheet = sheets[moneysheets[f.type]] + local sheet = sheets['money' .. (f.type)] local x = mix(f.x * sw, sw / 9 * 8, ease.outCubic(f.collecttimer)) local y = mix(f.y * sh, HEADER_HEIGHT - 20, ease.outCubic(f.collecttimer)) local frame = math.floor((f.time%1) * #sheet.quads) + 1 diff --git a/scenes/gameplay/main.lua b/scenes/gameplay/main.lua index 5609f16..d2b043d 100644 --- a/scenes/gameplay/main.lua +++ b/scenes/gameplay/main.lua @@ -16,7 +16,7 @@ local headerbuttons = { cost = 100, sprite = 'guppy', openanim = 1, - open = false, + open = true, closed = false, func = function() playSound('splash', 0.7, 0.8) @@ -28,7 +28,7 @@ local headerbuttons = { sprite = 'food', tier = foodtier, openanim = 1, - open = false, + open = true, closed = false, func = function(self) self.openanim = 0 @@ -46,7 +46,7 @@ local headerbuttons = { sprite = 'foodcount', tier = foodcount, openanim = 1, - open = false, + open = true, closed = false, func = function(self) self.openanim = 0 @@ -58,17 +58,6 @@ local headerbuttons = { self.tier = foodcount end end - }, - { - cost = 1000, - sprite = 'carnivore', - openanim = 1, - open = false, - closed = false, - func = function() - playSound('splash', 0.7, 0.8) - table.insert(feesh, constr.fish(math.random(), 0.3, 4)) - end } } @@ -93,14 +82,11 @@ function self.load() sheets.buttonopen = newAnimation(sprites['header/button_open'], sprites['header/button_open']:getWidth()/3, sprites['header/button_open']:getHeight()) - sheets.coin1 = newAnimation(sprites['money/coin1'], sprites['money/coin1']:getWidth()/10, sprites['money/coin1']:getHeight()) - sheets.coin2 = newAnimation(sprites['money/coin2'], sprites['money/coin2']:getWidth()/10, sprites['money/coin2']:getHeight()) - sheets.star = newAnimation(sprites['money/star'], sprites['money/star']:getWidth()/10, sprites['money/star']:getHeight()) - sheets.diamond = newAnimation(sprites['money/diamond'], sprites['money/diamond']:getWidth()/10, sprites['money/diamond']:getHeight()) - sheets.chest = newAnimation(sprites['money/chest'], sprites['money/chest']:getWidth()/10, sprites['money/chest']:getHeight()) + sheets.money1 = newAnimation(sprites['money/coin1'], sprites['money/coin1']:getWidth()/10, sprites['money/coin1']:getHeight()) + sheets.money2 = newAnimation(sprites['money/coin2'], sprites['money/coin2']:getWidth()/10, sprites['money/coin2']:getHeight()) for i = 1, 2 do - table.insert(feesh, constr.fish(math.random(), math.random(), 0)) + table.insert(feesh, constr.fish(math.random(), math.random())) end end @@ -122,12 +108,6 @@ function self.update(dt) bench.startBenchmark('update_fish') require('scenes.gameplay.update.fish')(feesh, dt, food, headerbuttons, money) bench.stopBenchmark('update_fish') - - if debug then - for _,b in ipairs(headerbuttons) do - b.open = true - end - end end function self.draw() @@ -182,9 +162,6 @@ function self.mousepressed(x, y, b) if m.type == 1 then balance = balance + 15 end if m.type == 2 then balance = balance + 35 end - if m.type == 3 then balance = balance + 40 end - if m.type == 4 then balance = balance + 200 end - if m.type == 5 then balance = balance + 2000 end return end @@ -192,7 +169,7 @@ function self.mousepressed(x, y, b) end if b == 1 and y > HEADER_HEIGHT and #food < foodcount then - if balance >= 5 or debug then + if balance >= 5 then table.insert(food, constr.food(x/love.graphics.getWidth(), y/love.graphics.getHeight(), foodtier)) playSound('dropfood') balance = balance - 5 @@ -211,7 +188,7 @@ function self.mousepressed(x, y, b) if hovered then if headerbuttons[i] and headerbuttons[i].open then - if balance >= headerbuttons[i].cost or debug then + if balance >= headerbuttons[i].cost then headerbuttons[i].func(headerbuttons[i]) playSound('buttonclick') balance = balance - headerbuttons[i].cost diff --git a/scenes/gameplay/update/fish.lua b/scenes/gameplay/update/fish.lua index ec612e1..b5437dd 100644 --- a/scenes/gameplay/update/fish.lua +++ b/scenes/gameplay/update/fish.lua @@ -32,49 +32,26 @@ return function(feesh, dt, food, headerbuttons, money) if n.eattimer <= 0 and not n.dead then -- needs to follow something local mx, my if n.eattimer <= 0 then - if n.size == 4 then -- carnivore - if n.shortestfood and feesh[n.shortestfood] then - local f = feesh[n.shortestfood] - mx, my = f.x, f.y - elseif frame % FISH_FOOD_CHECK_FREQ == 0 then - local minfood = 0 - local mindist = 9e9 + if n.shortestfood and food[n.shortestfood] then + local f = food[n.shortestfood] + mx, my = f.x, f.y + elseif frame % FISH_FOOD_CHECK_FREQ == 0 then + local minfood = 0 + local mindist = 9e9 - for i,f in ipairs(feesh) do - if f.size == 0 then - local dist = math.sqrt(math.pow(math.abs(f.render.x - n.render.x), 2) + math.pow(math.abs(f.render.y - n.render.y), 2)) - if dist < mindist then - mindist = dist - minfood = i - end - end - end - - if minfood ~= 0 then - n.shortestfood = minfood + for i,f in ipairs(food) do + local dist = math.sqrt(math.pow(math.abs(f.x - n.render.x), 2) + math.pow(math.abs(f.y - n.render.y), 2)) + if dist < mindist then + mindist = dist + minfood = i end end - else - if n.shortestfood and food[n.shortestfood] then - local f = food[n.shortestfood] - mx, my = f.x, f.y - elseif frame % FISH_FOOD_CHECK_FREQ == 0 then - local minfood = 0 - local mindist = 9e9 - for i,f in ipairs(food) do - local dist = math.sqrt(math.pow(math.abs(f.x - n.render.x), 2) + math.pow(math.abs(f.y - n.render.y), 2)) - if dist < mindist then - mindist = dist - minfood = i - end - end - - if minfood ~= 0 then - n.shortestfood = minfood - end + if minfood ~= 0 then + n.shortestfood = minfood end end + end if mx and my then angle = math.deg(math.atan2(my - n.y, mx - n.x)) + math.random(-FISH_FOLLOW_RANDOM, FISH_FOLLOW_RANDOM) @@ -125,8 +102,6 @@ return function(feesh, dt, food, headerbuttons, money) if n.size > 0 then local type = 2 if n.size == 1 then type = 1 end - if n.size == 3 then type = 3 end - if n.size == 4 then type = 4 end table.insert(money, constr.money(n.render.x, n.render.y, type)) end end @@ -148,27 +123,13 @@ return function(feesh, dt, food, headerbuttons, money) bench.stopBenchmark('update_fish_position') bench.startBenchmark('update_fish_colission') - if n.size == 4 then - if n.shortestfood and feesh[n.shortestfood] and frame % FISH_COLISSION_CHECK_FREQ == 0 and not n.dead then - local f = feesh[n.shortestfood] - local dist = math.abs(n.render.x - f.render.x) + math.abs(n.render.y - f.render.y) - - if dist < FOOD_HITBOX then - playSound('chomp', 1, 1 + math.random() * 0.1 - 0.05) - table.remove(feesh, n.shortestfood) - - n.eattimer = FISH_FOOD_3_COOLDOWN - n.render.eattimer = 0 - n.shortestfood = -1 - end - end - else - if n.shortestfood and food[n.shortestfood] and frame % FISH_COLISSION_CHECK_FREQ == 0 and not n.dead then - local f = food[n.shortestfood] + if n.shortestfood and food[n.shortestfood] and frame % FISH_COLISSION_CHECK_FREQ == 0 then + local f = food[n.shortestfood] + if f then local dist = math.abs(n.render.x - f.x) + math.abs(n.render.y - f.y) if dist < FOOD_HITBOX then - playSound('slurp', 1, 1 + math.random() * 0.1 - 0.05) + playSound('slurp') table.remove(food, n.shortestfood) local cooldowns = {FISH_FOOD_1_COOLDOWN, FISH_FOOD_2_COOLDOWN, FISH_FOOD_3_COOLDOWN} @@ -197,14 +158,6 @@ return function(feesh, dt, food, headerbuttons, money) headerbuttons[3].open = true headerbuttons[3].openanim = 0 end - if not headerbuttons[4].open and not headerbuttons[4].closed then - headerbuttons[4].open = true - headerbuttons[4].openanim = 0 - end - end - if n.lifetime > FISH_AGE_KING and n.size == 2 then - n.size = 3 - playSound('grow') end end end