more cursor stuff

This commit is contained in:
jill 2021-01-25 19:42:27 +03:00
parent c4d1846765
commit 00f4f5a30b
Signed by: oat
GPG key ID: DD83A9617A252385
6 changed files with 59 additions and 13 deletions

View file

@ -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

View file

@ -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