local velocity = {x=0,y=0} local lerpmnt = 0.5 local grav = 0.2 local gfx = playdate.graphics local active = false local imgRocket = gfx.image.new("gfx/rocket") assert(imgRocket) local sprRocket = gfx.sprite.new(imgRocket) sprRocket:setCollideRect(7, 7, 14, 14) function addPlayer(x,y) active = true sprRocket:moveTo(x,y) sprRocket:add() end function updatePlayer() if active then if playdate.buttonIsPressed(playdate.kButtonUp) then velocity.x = velocity.x + math.sin(math.rad(playdate.getCrankPosition())) velocity.y = velocity.y - math.cos(math.rad(playdate.getCrankPosition())) end sprRocket:moveBy(velocity.x,velocity.y) local cx, cy = gfx.getDrawOffset() gfx.setDrawOffset(playdate.math.lerp(cx,(-sprRocket.x + 200), lerpmnt), playdate.math.lerp(cy,(-sprRocket.y + 120), lerpmnt)) sprRocket:setRotation(0) sprRocket:update() --print(#sprRocket:overlappingSprites()) sprRocket:setRotation(playdate.getCrankPosition()) velocity.y += grav end end