base anims done

This commit is contained in:
PossiblyAxolotl 2022-05-14 10:40:45 -06:00
parent 29c4d0e106
commit 10d4683c4f
3 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,6 @@ local imgFire = gfx.imagetable.new("gfx/fire")
assert(imgRocket) assert(imgRocket)
local sprRocket = gfx.sprite.new(imgRocket) local sprRocket = gfx.sprite.new(imgRocket)
local loopFire = gfx.animation.loop.new(200,imgFire) local loopFire = gfx.animation.loop.new(200,imgFire)
local sprFire = gfx.sprite.new(loopFire:image())
sprRocket:setCollideRect(7, 7, 14, 14) sprRocket:setCollideRect(7, 7, 14, 14)
local startpos = {x=0,y=0} local startpos = {x=0,y=0}
@ -39,7 +38,6 @@ function addPlayer(_x,_y,__x,__y)
sprBigRocket:add() sprBigRocket:add()
sprRocket:moveTo(_x,_y) sprRocket:moveTo(_x,_y)
sprRocket:add() sprRocket:add()
sprFire:add()
sprRocket:setVisible(true) sprRocket:setVisible(true)
end end
@ -69,7 +67,7 @@ local function die()
end end
function updatePlayer() function updatePlayer()
sprFire:setImage(loopFire:image()) sprRocket:setImage(imgRocket)
if active == true then if active == true then
if playdate.buttonIsPressed(playdate.kButtonUp) or playdate.buttonIsPressed(playdate.kButtonA) then if playdate.buttonIsPressed(playdate.kButtonUp) or playdate.buttonIsPressed(playdate.kButtonA) then
velocity.x = velocity.x + math.sin(math.rad(playdate.getCrankPosition())) /2 velocity.x = velocity.x + math.sin(math.rad(playdate.getCrankPosition())) /2
@ -105,12 +103,14 @@ function updatePlayer()
end end
updateExit() updateExit()
if playdate.buttonIsPressed(playdate.kButtonA) or playdate.buttonIsPressed(playdate.kButtonUp) then
sprRocket:setImage(loopFire:image())
end
sprRocket:setScale(scale,scale) sprRocket:setScale(scale,scale)
sprFire:moveTo(sprRocket.x-math.sin(math.rad(playdate.getCrankPosition())*10),sprRocket.y+math.cos(math.rad(playdate.getCrankPosition()))*10)
sprRocket:setRotation(playdate.getCrankPosition()) sprRocket:setRotation(playdate.getCrankPosition())
sprFire:setRotation(playdate.getCrankPosition())
end end
function updateExit() function updateExit()

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B