made player shrink on win
This commit is contained in:
parent
07b48b6e0d
commit
49f32674e5
3 changed files with 30 additions and 1 deletions
|
@ -46,4 +46,5 @@ function playdate.update()
|
|||
gfx.sprite.update()
|
||||
drawTiles()
|
||||
end
|
||||
updateSaws()
|
||||
end
|
|
@ -1,9 +1,11 @@
|
|||
import "CoreLibs/math"
|
||||
import "CoreLibs/animator"
|
||||
|
||||
local velocity = {x=0,y=0}
|
||||
local lerpmnt <const> = 0.5
|
||||
local grav <const> = 0.2
|
||||
scale = 1
|
||||
local dead = false
|
||||
|
||||
local exists = false
|
||||
local active = false
|
||||
|
@ -22,6 +24,7 @@ sprBigRocket:setGroups({2})
|
|||
|
||||
function addPlayer(_x,_y,__x,__y)
|
||||
exists = true
|
||||
dead = false
|
||||
scale = 1
|
||||
active = false
|
||||
velocity = {x=0,y=0}
|
||||
|
@ -42,6 +45,7 @@ end
|
|||
local function playerWin()
|
||||
active = false
|
||||
exists = false
|
||||
dead = true
|
||||
end
|
||||
|
||||
local function die()
|
||||
|
@ -77,7 +81,10 @@ function updatePlayer()
|
|||
end
|
||||
local cx, cy = gfx.getDrawOffset()
|
||||
gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt))
|
||||
|
||||
elseif dead == true then
|
||||
if scale > 0.1 then
|
||||
scale -= 0.05
|
||||
end
|
||||
end
|
||||
updateExit()
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import "CoreLibs/animator"
|
||||
local gfx <const> = playdate.graphics
|
||||
|
||||
local imgSaw = gfx.image.new("gfx/sawblade")
|
||||
|
@ -17,6 +18,10 @@ function loadBlades(_blades)
|
|||
b.saw:setCollideRect(0,0,16,16)
|
||||
b.saw:add()
|
||||
|
||||
local a = gfx.animator.new(b.speed*1000, b.start, b.ends)
|
||||
|
||||
b.saw:setAnimator(a)
|
||||
|
||||
b.t1 = gfx.sprite.new(imgTarget)
|
||||
b.t1:moveTo(b.start)
|
||||
b.t2 = gfx.sprite.new(imgTarget)
|
||||
|
@ -27,6 +32,22 @@ function loadBlades(_blades)
|
|||
end
|
||||
end
|
||||
|
||||
function updateSaws()
|
||||
for b=1, #blades, 1 do
|
||||
b = blades[b]
|
||||
local pos = playdate.geometry.point.new(b.saw:getPosition())
|
||||
if pos == b.start then
|
||||
local a = gfx.animator.new(b.speed*1000, b.start, b.ends)
|
||||
|
||||
b.saw:setAnimator(a)
|
||||
elseif pos == b.ends then
|
||||
local a = gfx.animator.new(b.speed*1000, b.ends, b.start)
|
||||
|
||||
b.saw:setAnimator(a)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function killBlades()
|
||||
for i = 1, #blades, 1 do
|
||||
blades[i].t1:remove()
|
||||
|
|
Loading…
Reference in a new issue