0
任何人都可以幫助我。我爲跳動畫創建了一些精靈圖像。但它不能像我想要的那樣動畫,它只顯示第一幀(我將它設置爲7跳幀)。這是我的電暈代碼。我無法爲精靈動畫,我做錯了什麼?
function playerJump(event)
if event.phase == "ended" then
if doubleJump == false then
player:setLinearVelocity(0, 0)
player:applyForce(0,-30, player.x, player.y)
player:setSequence("jump")
jumpChannel = audio.play(jumpSound)
end
if singleJump == false then singleJump = true
else doubleJump = true end
end
return true
end
然後就是函數下面,我產生了精靈
local options =
{
width = 60, height = 100,
numFrames = 33,
sheetContentWidth = 1980,
sheetContentHeight = 100
}
playerSheet = graphics.newImageSheet("images/playerSprite.png", options)
playerSprite = {
{name="run", frames = {1,3,5,7,9,11,13,15,17,19,21,23,25}, time = 700, loopCount = 0 },
{name="jump", frames = {27,28,29,30,31,32,33}, time = 1000, loopCount = 1 },
}
--Add the jump listener
Runtime:addEventListener("touch", playerJump)
三江源非常 問候
是啊,我忘了:) – 2015-05-02 06:04:36