0
我有一個水圖像,在碰撞時殺死用戶精靈,從生命變量中取1,並重新生成精靈到開始。我有另一張木筏圖像,它不斷產生在屏幕上移動的新圖像。即時通訊試圖獲得它,使用戶可以移動到木筏上,即在水面上,而不是重新開始。有一個圖像否定另一個圖像的碰撞檢測
--sets the function for the death sequence.
function waterCollide(event)
frog.x = display.contentWidth/2
frog.y = 504
isOnRaft = 0
lives = lives - 1
showlives.text = "Lives: "..lives,230,-36,native.systemFont,25
lose()
end
--sets water
water = display.newRect(0,0,320,150)
water.x = display.contentWidth*0.5
water.y = 144
water.alpha = 0
physics.addBody(water,"static", {isSensor = true})
water:addEventListener("collision", function()timer.performWithDelay(50,waterCollide)end)
--Set log position and movement
local mRandom = math.random
local raft = {"Raft1" ,"Raft2"}
local objectTag = 0
local object = {}
function spawnlogleft()
objectTag = objectTag + 1
local objIdx = mRandom(#raft)
local objName = raft[objIdx]
object[objectTag] = display.newImage(objName..".png")
object[objectTag].x = -96
object[objectTag].y = 216
object[objectTag].name = objectTag
transition.to(object[objectTag], {time = 10000, x = 416, onComplete = function(obj) obj:removeSelf(); obj = nil; end})
physics.addBody(object[objectTag], "static",{isSensor = true})
end
spawnlogleft()
timer.performWithDelay(3500,spawnlogleft,0)
--user sprite details
frog = display.newSprite(frogSheet, sequenceData)
frog.x = display.contentWidth/2
frog.y = 504
physics.addBody(frog, "dynamic", physicsData:get("FrogSheetData"))
frog.isFixedRotation = true
用戶精靈是三幀和300時間的動畫。任何幫助將不勝感激。如果需要,我會提供更多細節。
謝謝
這與你提出的[其他問題](http://stackoverflow.com/q/19771145/828255)有什麼不同? –
,因爲我沒有動畫,當我只有固定的日誌。如果我因爲某種原因使用它,當在木筏上等於24時,isOnRaft = 1。 – Ross