From c4d1846765efbd4fda9a1a19f5e9971709ddba86 Mon Sep 17 00:00:00 2001 From: jill Date: Mon, 25 Jan 2021 18:17:32 +0300 Subject: [PATCH 1/3] cursors --- assets/sprites/cursor/dragging.png | Bin 0 -> 1515 bytes assets/sprites/cursor/hand.png | Bin 0 -> 1427 bytes assets/sprites/cursor/pointer.png | Bin 0 -> 1802 bytes main.lua | 7 +++++++ scenes/gameplay/main.lua | 22 +++++++++++++++++++++- 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 assets/sprites/cursor/dragging.png create mode 100644 assets/sprites/cursor/hand.png create mode 100644 assets/sprites/cursor/pointer.png diff --git a/assets/sprites/cursor/dragging.png b/assets/sprites/cursor/dragging.png new file mode 100644 index 0000000000000000000000000000000000000000..5d3d6e6ed0fa8a8357b1e1ba855903efa41b7456 GIT binary patch literal 1515 zcmV|ZN2!*0@LIh(*R_rQMAA^f)+;=#YI;$4UO2c_)GXc;9#S*0 zgz$;5N0$Q%-&%US&Tkf{>-=T09tkgk-Rh~NTR7grYDUiqPYJto*^=5gk98AgGQYAc zc}&(g24MpDQHWDwlPpENlJhdN_C8{n zz}Wx*010qNS#tmY3labT3lag+-G2N400bjRL_t(o!|hi~Xj4HHz2@`ML|dOlqpgMd zLydJI3PqHPh$31gXcsPA3a&*cSU)Qf#Nx^i=te}ug;ppUTqwG55hxT_5)pqbrNyc- z(U>-$rk?xeCcf0Pc`sFQkqeiZd2c>v&i%{`QB|r^m8$&TGN;0EZVP=f{|b~_wAMo3 z?@}i1f^ymD>k}{mXnl!)W?>*vXvD-?=1+slv$FxZ4cZ{Uq9p*5d>@g25ot%Q0Dx(%~6_neaU zIij8ms(#=!wZ8dK7}q4_3+Tskf#9&|gUVDI(JDUx0NlhRkza={Q5`f7(Y(2Z{(-eC zD2Q?=bRTppZ=ziEI&6gh59oWCCBlq+8wZd&A}8WEhPn$*LstQO8PUxv zL;%)`v74bg#0?gg2oB4j%n`T99O^M<1wbC0CE9-m?FlecC!vQ?KEJ9jL>ank0OL7Y zpl!ldMNGL(fHsNF=QY9B00T(_hz`@`V9pr3e2p5ICRKM~_ADAr0NH!lV2&AEE4Pt+BD% zO3lXuJxntL7=5ZUB!8%|boOK?lFnt2g;EsBsebWJRl(`S_js~GGnJpvqWpV#X=sJ$Rc?wWMbPAyKm`bjuIfqO~ zO-XTD^gW(TkH*OHBuq<#?QndU(OCyTiG*Pu1IUkJKrCPIZC6);rF+n4d@@MyTqQo0 zXKMi3&y2l#N0B|qJ;S43N=FllrP!3~oV1yx(OA)3FNOKV|Vq0GtzhPs3DSzJdmngSb(3oVUl4o%>Wq*ow#z(J+~!=DkM%$SYx= zCrg}~)5VnWmRPb2icG*-I2~L&sd88JlS*iYz@m3fz=9}`ULtxsLUDY(A?CMq`?T|L z$UhqRnApX4BspLWnN0mYKmgr`J~UnM%049QJRC9tDw4nK;bu7^2W+W_LtISOZwFAN z?>_S#t7)1OKPkR5Wan-^+sCNSbd&J?x=9se+;mLYe*0Al%IZrwLsj{U@)Oo3Ql6@5 Rt|tHh002ovPDHLkV1lt3yg2{> literal 0 HcmV?d00001 diff --git a/assets/sprites/cursor/hand.png b/assets/sprites/cursor/hand.png new file mode 100644 index 0000000000000000000000000000000000000000..f278e724f6d6c35499465842cc9d326ae2206783 GIT binary patch literal 1427 zcmV;E1#J3>P)|ZN2!*0@LIh(*R_rQMAA^f)+;=#YI;$4UO2c_)GXc;9#S*0 zgz$;5N0$Q%-&%US&Tkf{>-=T09tkgk-Rh~NTR7grYDUiqPYJto*^=5gk98AgGQYAc zc}&(g24MpDQHWDwlPpENlJhdN_C8{n zz}Wx*010qNS#tmY3labT3lag+-G2N400YZOL_t(&-tC%8YZFlzhToZVW|EjmV`7Y@ zYO6xLP;V3w6-5x;38L=ArQ%Y-zaXgK4LAM1?POgr@)c$3VTPLgN7^W9D(>AH^pVaWJTh5!|y0#twsPys4H1*iZOpaN8Y z3Qz$mKn17(6`%rit&a|eKBtou;;%EL>{zbeJG-ojqj2A5yhi**Z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!v6)<8y29rV7QlU*VR<; z^5t7d5WGm>J>(Vk_xEGqdD#Iba%zjEu|awbZUt%-23~}#CycZz&44ev!31JYu3I?YZ-zKu!=O)-VdNGi0NaCp<6|E?BXpe7U4^D#kfC zcY7yTy{mhZ_AWVz7^ygH#23H0^F66NbcW@(tuRbe1=;K(ACLcm9zB{x_kSBfcYjJC zrDP+k7eSCwlcCMch#m+WC$l3co9ch#7iVyNV-7^0JOC3D ziy*Def#1ifAn{ZLw#w@CYsx`+9&@smBHJx;H8no@ov}4*<#G`e3jaKd)zu`>g&8nC zu7X&c)hWuLaUdQv&6X&`(dh5W&Hn}VG7EG_tz~$v1?WsSuWuXVq_pS6nwWp`Q+=e(yjK-m1<#_^Mz_CO- z!Q5_*glXd6`uG>@_tq=~dFZV|r&Ua1H&i1RO!u;u=q$$-X>4q>bXVLB)oj?yqO&zi sbLPt~(H&ISo)FC}f*amk*kNn`0@_Y7p}o}uFaQ7m07*qoM6N<$g3ymx5&!@I literal 0 HcmV?d00001 diff --git a/main.lua b/main.lua index d0fe3a2..855133a 100644 --- a/main.lua +++ b/main.lua @@ -20,6 +20,7 @@ sprites = {} sound_path = {} music_path = {} fonts = {} +cursors = {} debug = false @@ -48,6 +49,12 @@ function love.load() fonts.default = love.graphics.newFont(12) if scene.load then scene.load() end + + cursors.default = love.mouse.newCursor('assets/sprites/cursor/pointer.png', sprites['cursor/pointer']:getWidth()/2, sprites['cursor/pointer']:getHeight()/2) + cursors.hover = love.mouse.newCursor('assets/sprites/cursor/hand.png', sprites['cursor/hand']:getWidth()/2, sprites['cursor/hand']:getHeight()/2) + cursors.drag = love.mouse.newCursor('assets/sprites/cursor/dragging.png', sprites['cursor/dragging']:getWidth()/2, sprites['cursor/dragging']:getHeight()/2) + + love.mouse.setCursor(cursors.default) end frame = 0 diff --git a/scenes/gameplay/main.lua b/scenes/gameplay/main.lua index 5609f16..204ad17 100644 --- a/scenes/gameplay/main.lua +++ b/scenes/gameplay/main.lua @@ -106,9 +106,29 @@ end function self.update(dt) bench.startBenchmark('update_buttons') - for _,btn in ipairs(headerbuttons) do + + local x = 19 + local y = 3 + local anyhover = false + for b,btn in ipairs(headerbuttons) do btn.openanim = btn.openanim + dt * 6 + 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 then + love.mouse.setCursor(cursors.hover) + anyhover = true + end + + local incr = 69 -- its like button positions but forcefully shoved into a recursive function :D + if b == 2 then incr = 57 end + if b >= 3 then incr = 73 end + x = x + incr end + if not anyhover then + love.mouse.setCursor(cursors.default) + end + bench.stopBenchmark('update_buttons') bench.startBenchmark('update_food') From 00f4f5a30b6f0d1a5eff3a6782c2527954fdac28 Mon Sep 17 00:00:00 2001 From: jill Date: Mon, 25 Jan 2021 19:42:27 +0300 Subject: [PATCH 2/3] more cursor stuff --- constructors.lua | 2 +- main.lua | 12 ++++++++++++ scenes/gameplay/draw/header.lua | 30 +++++++++++++++++++++++++++++- scenes/gameplay/main.lua | 15 +++++++-------- scenes/gameplay/update/fish.lua | 6 ++++-- scenes/gameplay/update/money.lua | 7 ++++++- 6 files changed, 59 insertions(+), 13 deletions(-) diff --git a/constructors.lua b/constructors.lua index c1f5077..500b5cf 100644 --- a/constructors.lua +++ b/constructors.lua @@ -7,7 +7,7 @@ function self.fish(x, y, type) local fish = { x = x, y = y, - size = type, -- 0 for small, 1 for medium, 2 for big, 3 for king, 4 for carnivore + size = 2, -- 0 for small, 1 for medium, 2 for big, 3 for king, 4 for carnivore 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/main.lua b/main.lua index 855133a..ca3143a 100644 --- a/main.lua +++ b/main.lua @@ -57,8 +57,14 @@ function love.load() love.mouse.setCursor(cursors.default) end +local cursor +function setCursor(mouse) + cursor = mouse +end + frame = 0 function love.update(dt) + cursor = nil frame = frame + 1 bench.update() tick.update(dt) @@ -66,6 +72,12 @@ function love.update(dt) bench.startBenchmark('update') if scene.update then scene.update(dt) end bench.stopBenchmark('update') + + if cursor then + love.mouse.setCursor(cursor) + else + love.mouse.setCursor(cursors.default) + end end function love.draw() diff --git a/scenes/gameplay/draw/header.lua b/scenes/gameplay/draw/header.lua index 8449f86..07c4e09 100644 --- a/scenes/gameplay/draw/header.lua +++ b/scenes/gameplay/draw/header.lua @@ -5,23 +5,40 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance) love.graphics.setColor(1, 1, 1, 1) love.graphics.draw(base, 0, 0, 0, size, size) + local tooltip + local tooltipText + local tooltipx + local tooltipy + -- the game is making me do this. im sorry 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) local btn = headerbuttons[b] - + if (btn and not btn.open) or not btn then -- draw nothing elseif hovered and love.mouse.isDown(1) then love.graphics.draw(sprites['header/buttonbg_down'], x * size, y * size, 0, size, size) + if not tooltip then tooltip = btn.tooltip end elseif hovered then love.graphics.draw(sprites['header/buttonbg_hover'], x * size, y * size, 0, size, size) + if not tooltip then tooltip = btn.tooltip end else love.graphics.draw(sprites['header/buttonbg'], x * size, y * size, 0, size, size) end + if tooltip and btn and not tooltipText then + if not btn.tooltipText then + btn.tooltipText = love.graphics.newText(fonts.pix, tooltip) + end + + tooltipText = btn.tooltipText + tooltipx = x + sprites['header/buttonbg']:getWidth() * size * 0.5 - tooltipText:getWidth()/2 + tooltipy = y + sprites['header/buttonbg']:getWidth() * size + end + if btn then if btn.open then -- sprite inside @@ -88,5 +105,16 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance) love.graphics.setColor(179/255, 254/255, 89/255) local leftpad = 100 love.graphics.printf(balance, round(sw * 0.965 - leftpad), round(HEADER_HEIGHT - 25), leftpad, 'right') + + 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) + love.graphics.rectangle('line', round(tooltipx - 5), round(tooltipy - 5), round(tooltipText:getWidth() + 10), round(tooltipText:getHeight() + 10)) + + love.graphics.setFont(fonts.pix) + love.graphics.draw(tooltipText, round(tooltipx), round(tooltipy)) + end + love.graphics.setFont(fonts.default) end \ No newline at end of file diff --git a/scenes/gameplay/main.lua b/scenes/gameplay/main.lua index 204ad17..1c00aa2 100644 --- a/scenes/gameplay/main.lua +++ b/scenes/gameplay/main.lua @@ -16,6 +16,7 @@ local headerbuttons = { cost = 100, sprite = 'guppy', openanim = 1, + tooltip = 'buy guppy', open = false, closed = false, func = function() @@ -28,6 +29,7 @@ local headerbuttons = { sprite = 'food', tier = foodtier, openanim = 1, + tooltip = 'upgrade food quality', open = false, closed = false, func = function(self) @@ -46,6 +48,7 @@ local headerbuttons = { sprite = 'foodcount', tier = foodcount, openanim = 1, + tooltip = 'upgrade food quantity', open = false, closed = false, func = function(self) @@ -62,6 +65,7 @@ local headerbuttons = { { cost = 1000, sprite = 'carnivore', + tooltip = 'buy carnivore', openanim = 1, open = false, closed = false, @@ -109,15 +113,13 @@ function self.update(dt) local x = 19 local y = 3 - local anyhover = false for b,btn in ipairs(headerbuttons) do btn.openanim = btn.openanim + dt * 6 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 then - love.mouse.setCursor(cursors.hover) - anyhover = true + setCursor(cursors.hover) end local incr = 69 -- its like button positions but forcefully shoved into a recursive function :D @@ -125,9 +127,6 @@ function self.update(dt) if b >= 3 then incr = 73 end x = x + incr end - if not anyhover then - love.mouse.setCursor(cursors.default) - end bench.stopBenchmark('update_buttons') @@ -136,7 +135,7 @@ function self.update(dt) bench.stopBenchmark('update_food') bench.startBenchmark('update_money') - require('scenes.gameplay.update.money')(money, dt) + require('scenes.gameplay.update.money')(money, dt, sheets) bench.stopBenchmark('update_money') bench.startBenchmark('update_fish') @@ -195,7 +194,7 @@ function self.mousepressed(x, y, b) if b == 1 then for _,m in ipairs(money) do local dist = math.abs(x/love.graphics.getWidth() - m.x) + math.abs(y/love.graphics.getHeight() - m.y) - if dist < 0.1 and not m.collected then + if dist < sheets.coin1.width/2 and not m.collected then m.collected = true m.deathtimer = 0 playSound('collect', 1, 1 + math.random() * 0.2 - 0.1) diff --git a/scenes/gameplay/update/fish.lua b/scenes/gameplay/update/fish.lua index ec612e1..c0110f3 100644 --- a/scenes/gameplay/update/fish.lua +++ b/scenes/gameplay/update/fish.lua @@ -29,6 +29,7 @@ return function(feesh, dt, food, headerbuttons, money) local str = math.random(70, 200)/200/4 angle = mix(angle, math.deg(math.atan2((0.5 + math.sin(love.timer.getTime()/10 + fi) * 0.2) - n.y, 0)), 0.1) -- slightly head towards the middle, to prevent getting stuck at the bottom or top + local followingObj = (n.shortestfood and food[n.shortestfood] and n.size ~= 4) or (n.shortestfood and feesh[n.shortestfood] and n.size == 4) if n.eattimer <= 0 and not n.dead then -- needs to follow something local mx, my if n.eattimer <= 0 then @@ -85,7 +86,7 @@ return function(feesh, dt, food, headerbuttons, money) local x = math.cos(math.rad(angle)) * str local y = math.sin(math.rad(angle)) * str - if not ((n.shortestfood and food[n.shortestfood]) or n.dead) then + if not (followingObj or n.dead) then x = x * math.sign(n.render.x - n.render.prevx) end @@ -101,8 +102,9 @@ return function(feesh, dt, food, headerbuttons, money) end e.speed = 1 / (math.sqrt(math.pow(math.abs(e.x - e.fromx), 2) + math.pow(math.abs(e.y - e.fromy), 2))/2) / 15 - if n.eattimer < FISH_FOOD_HUNGRY or (n.shortestfood and food[n.shortestfood]) then + if n.eattimer < FISH_FOOD_HUNGRY or followingObj then e.speed = e.speed * 1.3 + if n.size == 4 then e.speed = e.speed * 1.1 end end if n.dead then e.speed = e.speed * 0.2 diff --git a/scenes/gameplay/update/money.lua b/scenes/gameplay/update/money.lua index 1220fb1..5fc4fba 100644 --- a/scenes/gameplay/update/money.lua +++ b/scenes/gameplay/update/money.lua @@ -1,4 +1,4 @@ -return function(money, dt) +return function(money, dt, sheets) for i,f in ipairs(money) do if not f.collected then f.y = f.y + dt * f.speed @@ -16,5 +16,10 @@ return function(money, dt) if f.deathtimer > 1 or f.collecttimer > 1 then table.remove(money, i) end + + local dist = math.abs(love.mouse.getX() - f.x * love.graphics.getWidth()) + math.abs(love.mouse.getY() - f.y * love.graphics.getHeight()) + if dist < sheets.coin1.width/2 and not f.collected then + setCursor(cursors.hover) + end end end \ No newline at end of file From 0cf9e962b6798a604f2d8bf6de111d92344f14c2 Mon Sep 17 00:00:00 2001 From: jill Date: Mon, 25 Jan 2021 21:05:06 +0300 Subject: [PATCH 3/3] star fish --- assets/audio/sfx/explode.ogg | Bin 0 -> 5036 bytes assets/sprites/header/moneyflash.png | Bin 0 -> 807 bytes assets/sprites/header/optionsbutton_down.png | Bin 0 -> 2597 bytes assets/sprites/header/optionsbutton_hover.png | Bin 0 -> 2483 bytes constructors.lua | 3 +- scenes/gameplay/draw/fish.lua | 17 ++++- scenes/gameplay/draw/food.lua | 14 +++- scenes/gameplay/draw/header.lua | 12 +++- scenes/gameplay/main.lua | 45 ++++++++++--- scenes/gameplay/update/fish.lua | 60 ++++++++++-------- 10 files changed, 110 insertions(+), 41 deletions(-) create mode 100644 assets/audio/sfx/explode.ogg create mode 100644 assets/sprites/header/moneyflash.png create mode 100644 assets/sprites/header/optionsbutton_down.png create mode 100644 assets/sprites/header/optionsbutton_hover.png diff --git a/assets/audio/sfx/explode.ogg b/assets/audio/sfx/explode.ogg new file mode 100644 index 0000000000000000000000000000000000000000..80b4caad3e1935c3836475f7c87976e6ccd00acf GIT binary patch literal 5036 zcmcIndpMJQ_0poXoQt-T)1Hr3BPZ_vLV{g#@fc(daJdqp(&Oanm`~$ha0*_A0x%ZL{o^- z@d$-UE%0{tarJd`$8HBzsn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o^x$A3Q^LL<) z4qkK2EcSWUY30}Oj`8ks{?w*7D)nU@2Lf=Kp~4aJ&j-Ic)?DasJ~g_wc6+>6RLdzw zZA#u>_Sik&W@PF|IGuYaxtLAWNgv5~=z2#>7?I-#IyuGtb}zT)4y99_yXH^bOjLRE z4&goi?)CWi)rs@Z&d6*gO}=33eNkGwhGg=NUr&#hAu0;iF`v(G6><}a$aBZtgCw<)C*}PA1b~$s} zJYaKq)TZ_rFYP#dkKm3K8z?S0Tu5?N1H1o4Xvi$Tww;`b&QCwa{{IHVch)(PYpZ?arohIY0brF)n`L@8akyI$ax%I zSK>_8K4+f^snhVci}Z=YSsVl~hWxnGHWl>C;Nhshud^ zM9~P@;mAe?$qMYB8l=RRe7s+VI8A?TKsU;Sm<06Yyn}VlEDdrOp}OK4lkXWdGY$}Q LS4wurJy`TVlfxN* literal 0 HcmV?d00001 diff --git a/assets/sprites/header/moneyflash.png b/assets/sprites/header/moneyflash.png new file mode 100644 index 0000000000000000000000000000000000000000..f6e262a7eb6e4c75c09a700439bd8d442ab97be9 GIT binary patch literal 807 zcmV+?1K9kDP)1DYb%Cm*h5Sg(M9(DNlIVHAUiV@hVWwUADy&@p}2PD1~y5jMh;DX0rf_XNx2>3-$snEho3$r3Oh^L9ehF)fk^N5=SRdZ#T z@))gg*vKG>1SBXZV-q?YL@Apzv-ZAN-M54ic^LgIRKUqmK#{x=Qp?m;rL2*z(x;;$ z=Kg=4wl)*@x(5?L_p9rEP5?doK&|S!zo)KSI|BkQz_r=*muOCN-=tTYTKE_U?EsfI zO-(rfu6BWuXG`XCT?)|hYZ~xz0Sx4Tp?jcj-J4ZoALma%cAK8)4mdmlCaFHO@dqgt zXdPuIoU#A_010qNS#tmY3labT3lag+-G2N400CP`L_t(o!|m8TOT$1M$MIic6b&Lu zQ3R7dPzN6dZM#^U1i|7W=q8HJU3?|tYjDt);3iRU)KVOZLyL`xv`J0Dp;bW|dx8Qxn@6wZMajZH@Y)hITOC{2)30xR+nQApukN9kgqQ| z#C~HT)jaFez%Jj1E+vDNr8x+mDjU?-I=&Y%ahZj1(Oa!QawPJNQg>AxooL{RqP4C^ zWx{JG!XrGwBRs;R2#@dxkMJnMYcbt+XUV+>urul_p7(-kj`j|YwJ_W7UP%$)=S4ST z&V6V3z(B+-Av7HTAA1zR>1YhK2%(~el;HcYxKr8E{{Uns lE?Pfv8;Kw);xh^b6E8iKcLb_Ub!Pwo002ovPDHLkV1i1KVw3;? literal 0 HcmV?d00001 diff --git a/assets/sprites/header/optionsbutton_down.png b/assets/sprites/header/optionsbutton_down.png new file mode 100644 index 0000000000000000000000000000000000000000..533ac1e6b312a5d653795bc48627896a6eb850af GIT binary patch literal 2597 zcmV+=3flFFP)1DYb%Cm*h5Sg(M9(DNlIVHAUiV@hVWwUADy&@p}2PD1~y5jMh;DX0rf_XNx2>3-$snEho3$r3Oh^L9ehF)fk^N5=SRdZ#T z@))gg*vKG>1SBXZV-q?YL@Apzv-ZAN-M54ic^LgIRKUqmK#{x=Qp?m;rL2*z(x;;$ z=Kg=4wl)*@x(5?L_p9rEP5?doK&|S!zo)KSI|BkQz_r=*muOCN-=tTYTKE_U?EsfI zO-(rfu6BWuXG`XCT?)|hYZ~xz0Sx4Tp?jcj-J4ZoALma%cAK8)4mdmlCaFHO@dqgt zXdPuIoU#A_010qNS#tmY3labT3lag+-G2N400>!0L_t(&-tAgzOjB1J|5sZ;>7uwt_F>bRELrwpbIIb2Fhf8wG}fvSrunH3$ew2QnB34GoUctE;0A!nDz#Pl^*4VGGtb zw8Nct$AXCX=u)k4t*Bf_`Q;A|@|3k-zG#Q6)dul^FNuu>=mIlpIW?*+V$93f0t^tG z9G&|rnNS6%zB5Bf`34aXT(ITxHHl;JZCK?3Duk?-5rAXgQ=TxM@xUNYk(}l|R^a(M89AbI>DEV+0H6?z*;HO++X! zkf*?;Avx110@YM)76Eybz+g-bB{=r@*WeS+bvU3U2fHVnY92HVKOZ|!$4n9)E{fJm z=Idh@X_e#i34TCKYj)G@+2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WAphLEGT*{Q>xDqs(;YtXAEfCoC_Ni~Fy0%#}28!gY z$QK!~Crl*mr=Wr8GTVYjDECv$ zF8e78qR#RaJtHQ&t@T=ok{HzbK?)8$Kvaxl6VvGLKgxL9kFas{J9pIKAWsJ5DSA_k}-CTc7_YjAR4+X4l^{ucXp-UTy#Y002ovPDHLkV1l{urFj4V literal 0 HcmV?d00001 diff --git a/constructors.lua b/constructors.lua index 500b5cf..b6e5ca9 100644 --- a/constructors.lua +++ b/constructors.lua @@ -11,6 +11,7 @@ function self.fish(x, y, type) 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, + star = false, lifetime = 0, @@ -54,7 +55,7 @@ function self.food(x, y, type) speed = 0.2, time = math.random(), deathtimer = 0, - type = type + type = type -- 1 = tier 1, 2 = tier 2, 3 = tier 3, 4 = star potion } return food diff --git a/scenes/gameplay/draw/fish.lua b/scenes/gameplay/draw/fish.lua index 7e2ef5e..fe6724c 100644 --- a/scenes/gameplay/draw/fish.lua +++ b/scenes/gameplay/draw/fish.lua @@ -65,11 +65,24 @@ return function(feesh, spritescale, fishsprite) local sadsheet = fishsprite(size, true, anim) local alpha = n.render.hungry == 1 and 0 or 1 - love.graphics.setColor(1, 1, 1, alpha - n.render.deathanim) + local allalpha = 1 + if n.star then allalpha = 0.8 end + love.graphics.setColor(1, 1, 1, (alpha - n.render.deathanim) * allalpha) love.graphics.draw(sheet.spriteSheet, sheet.quads[math.max(math.min(frame, #sample.quads), 1)], x, y, angle, sizex * spritescale, spritescale, sample.width/2, sample.height/2) - love.graphics.setColor(1, 1, 1, n.render.hungry - n.render.deathanim) + love.graphics.setColor(1, 1, 1, (n.render.hungry - n.render.deathanim) * allalpha) love.graphics.draw(sadsheet.spriteSheet, sheet.quads[math.max(math.min(frame, #sample.quads), 1)], x, y, angle, sizex * spritescale, spritescale, sample.width/2, sample.height/2) + if n.star then + local mult = (math.sin(love.timer.getTime() / 4) / 2 + 0.5) * 0.1 + 0.9 + + love.graphics.setBlendMode('add') + love.graphics.setColor(1, 1, 1, (alpha - n.render.deathanim) * mult) + love.graphics.draw(sheet.spriteSheet, sheet.quads[math.max(math.min(frame, #sample.quads), 1)], x, y, angle, sizex * spritescale, spritescale, sample.width/2, sample.height/2) + love.graphics.setColor(1, 1, 1, (n.render.hungry - n.render.deathanim) * mult) + love.graphics.draw(sadsheet.spriteSheet, sheet.quads[math.max(math.min(frame, #sample.quads), 1)], x, y, angle, sizex * spritescale, spritescale, sample.width/2, sample.height/2) + love.graphics.setBlendMode('alpha') + end + love.graphics.setColor(1, 1, 1) if debug then love.graphics.print(shrt(n.eattimer), x + 20, y + 20) end diff --git a/scenes/gameplay/draw/food.lua b/scenes/gameplay/draw/food.lua index 99d0a2e..e79e074 100644 --- a/scenes/gameplay/draw/food.lua +++ b/scenes/gameplay/draw/food.lua @@ -1,7 +1,11 @@ -return function(food, sheets, spritescale) +local sheetNames = { + 'food1', 'food2', 'food3', 'potion' +} + +return function(food, sheets, spritescale, starpotionequipped) local sw, sh = love.graphics.getDimensions() for _,f in ipairs(food) do - local sheet = sheets['food' .. (f.type)] + local sheet = sheets[sheetNames[f.type]] local x = f.x * sw local y = f.y * sh local frame = math.floor((f.time%1) * #sheet.quads) + 1 @@ -10,4 +14,10 @@ return function(food, sheets, spritescale) love.graphics.draw(sheet.spriteSheet, sheet.quads[math.max(math.min(frame, #sheet.quads), 1)], x, y, 0, spritescale, spritescale, sheet.width/2, sheet.height/2) end + + if starpotionequipped then + local sheet = sheets.potion + love.graphics.setColor(1, 1, 1, 0.8) + love.graphics.draw(sheet.spriteSheet, sheet.quads[1], love.mouse.getX(), love.mouse.getY(), 0, spritescale, spritescale, sheet.width/2, sheet.height/2) + end end \ No newline at end of file diff --git a/scenes/gameplay/draw/header.lua b/scenes/gameplay/draw/header.lua index 07c4e09..972d02c 100644 --- a/scenes/gameplay/draw/header.lua +++ b/scenes/gameplay/draw/header.lua @@ -1,4 +1,4 @@ -return function(headerheight, fishsprite, headerbuttons, sheets, balance) +return function(headerheight, fishsprite, headerbuttons, sheets, balance, moneyflashtimer) local sw, sh = love.graphics.getDimensions() local base = sprites['header/base'] local size = headerheight / HEADER_HEIGHT @@ -68,6 +68,12 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance) love.graphics.setColor(0, 1, 0) love.graphics.printf(btn.tier + 1, round(x * size), round(y * size + offset*0.75 - fonts.continuum:getHeight()/2), round(sprites['header/buttonbg']:getWidth() * size), 'center') + elseif btn.sprite == 'starpotion' then + local sheet = sheets.potion + + local scale = (sprites['header/buttonbg']:getWidth() / sheet.width) * 0.65 + local offset = (sprites['header/buttonbg']:getWidth() * size) / 2 + love.graphics.draw(sheet.spriteSheet, sheet.quads[1], x * size + offset, y * size + offset*0.75, 0, size * scale, size * scale, sheet.width/2, sheet.width/2) end -- price @@ -101,11 +107,13 @@ return function(headerheight, fishsprite, headerbuttons, sheets, balance) 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) love.graphics.setColor(179/255, 254/255, 89/255) local leftpad = 100 - love.graphics.printf(balance, round(sw * 0.965 - leftpad), round(HEADER_HEIGHT - 25), leftpad, 'right') + love.graphics.printf(balance, round(sw * 0.965 - leftpad), round((HEADER_HEIGHT - 25) * size), leftpad, 'right') + -- tooltips 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)) diff --git a/scenes/gameplay/main.lua b/scenes/gameplay/main.lua index 1c00aa2..c776d49 100644 --- a/scenes/gameplay/main.lua +++ b/scenes/gameplay/main.lua @@ -11,6 +11,9 @@ local balance = 100 local foodtier = 1 local foodcount = 1 +local starpotionequipped = false +local moneyflashtimer = 0 + local headerbuttons = { { cost = 100, @@ -73,6 +76,17 @@ local headerbuttons = { playSound('splash', 0.7, 0.8) table.insert(feesh, constr.fish(math.random(), 0.3, 4)) end + }, + { + cost = 250, + sprite = 'starpotion', + tooltip = 'buy star potion', + openanim = 1, + open = true, + closed = false, + func = function() + starpotionequipped = true + end } } @@ -94,6 +108,7 @@ function self.load() sheets.food1 = newAnimation(sprites['food/1'], sprites['food/1']:getWidth()/10, sprites['food/1']:getHeight()) sheets.food2 = newAnimation(sprites['food/2'], sprites['food/2']:getWidth()/10, sprites['food/2']:getHeight()) sheets.food3 = newAnimation(sprites['food/3'], sprites['food/3']:getWidth()/10, sprites['food/3']:getHeight()) + sheets.potion = newAnimation(sprites['food/potion'], sprites['food/potion']:getWidth()/10, sprites['food/potion']:getHeight()) sheets.buttonopen = newAnimation(sprites['header/button_open'], sprites['header/button_open']:getWidth()/3, sprites['header/button_open']:getHeight()) @@ -111,6 +126,8 @@ end function self.update(dt) bench.startBenchmark('update_buttons') + moneyflashtimer = moneyflashtimer - dt + local x = 19 local y = 3 for b,btn in ipairs(headerbuttons) do @@ -172,7 +189,7 @@ function self.draw() bench.stopBenchmark('render_shadow') bench.startBenchmark('render_food') - require('scenes.gameplay.draw.food')(food, sheets, spritescale) + require('scenes.gameplay.draw.food')(food, sheets, spritescale, starpotionequipped) bench.stopBenchmark('render_food') -- all the fish @@ -182,7 +199,7 @@ function self.draw() bench.stopBenchmark('render_tank') bench.startBenchmark('render_header') - require('scenes.gameplay.draw.header')(headerheight, fishsprite, headerbuttons, sheets, balance) + require('scenes.gameplay.draw.header')(headerheight, fishsprite, headerbuttons, sheets, balance, moneyflashtimer) bench.stopBenchmark('render_header') bench.startBenchmark('render_money') @@ -193,7 +210,7 @@ end function self.mousepressed(x, y, b) if b == 1 then for _,m in ipairs(money) do - local dist = math.abs(x/love.graphics.getWidth() - m.x) + math.abs(y/love.graphics.getHeight() - m.y) + 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 m.collected = true m.deathtimer = 0 @@ -210,14 +227,23 @@ function self.mousepressed(x, y, b) end end - if b == 1 and y > HEADER_HEIGHT and #food < foodcount then - if balance >= 5 or debug then - table.insert(food, constr.food(x/love.graphics.getWidth(), y/love.graphics.getHeight(), foodtier)) + 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') - balance = balance - 5 - else - playSound('buzzer') + starpotionequipped = false + elseif #food < foodcount then + if balance >= 5 or debug then + table.insert(food, constr.food(x/love.graphics.getWidth(), y/love.graphics.getHeight(), foodtier)) + playSound('dropfood') + balance = balance - 5 + else + playSound('buzzer') + moneyflashtimer = 1.2 + end end + + return end local headerheight = HEADER_HEIGHT * love.graphics.getWidth()/640 @@ -236,6 +262,7 @@ function self.mousepressed(x, y, b) balance = balance - headerbuttons[i].cost else playSound('buzzer') + moneyflashtimer = 1.2 end end end diff --git a/scenes/gameplay/update/fish.lua b/scenes/gameplay/update/fish.lua index c0110f3..3aa7407 100644 --- a/scenes/gameplay/update/fish.lua +++ b/scenes/gameplay/update/fish.lua @@ -129,6 +129,7 @@ return function(feesh, dt, food, headerbuttons, money) if n.size == 1 then type = 1 end if n.size == 3 then type = 3 end if n.size == 4 then type = 4 end + if n.star then type = 3 end table.insert(money, constr.money(n.render.x, n.render.y, type)) end end @@ -174,39 +175,48 @@ return function(feesh, dt, food, headerbuttons, money) table.remove(food, n.shortestfood) local cooldowns = {FISH_FOOD_1_COOLDOWN, FISH_FOOD_2_COOLDOWN, FISH_FOOD_3_COOLDOWN} - n.eattimer = cooldowns[f.type] + n.eattimer = cooldowns[f.type] or FISH_FOOD_3_COOLDOWN n.render.eattimer = 0 n.shortestfood = -1 - if n.lifetime > FISH_AGE_MEDIUM and n.size == 0 then - n.size = 1 - playSound('grow') + if f.type == 4 then -- star potion + if n.size == 2 or n.size == 3 then + n.star = true + else + n.eattimer = -9e9 + playSound('explode') + end + else + if n.lifetime > FISH_AGE_MEDIUM and n.size == 0 then + n.size = 1 + playSound('grow') - if not headerbuttons[1].open and not headerbuttons[1].closed then - headerbuttons[1].open = true - headerbuttons[1].openanim = 0 + if not headerbuttons[1].open and not headerbuttons[1].closed then + headerbuttons[1].open = true + headerbuttons[1].openanim = 0 + end end - end - if n.lifetime > FISH_AGE_BIG and n.size == 1 then - n.size = 2 - playSound('grow') + if n.lifetime > FISH_AGE_BIG and n.size == 1 then + n.size = 2 + playSound('grow') - if not headerbuttons[2].open and not headerbuttons[2].closed then - headerbuttons[2].open = true - headerbuttons[2].openanim = 0 + if not headerbuttons[2].open and not headerbuttons[2].closed then + headerbuttons[2].open = true + headerbuttons[2].openanim = 0 + end + if not headerbuttons[3].open and not headerbuttons[3].closed then + 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 not headerbuttons[3].open and not headerbuttons[3].closed then - headerbuttons[3].open = true - headerbuttons[3].openanim = 0 + if n.lifetime > FISH_AGE_KING and n.size == 2 then + n.size = 3 + playSound('grow') 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