Lua / 电晕 sdk physics.addBody()
Lua / corona sdk physics.addBody()
当我的球击中但 30 个目标时 30 个新的 returns 除了我有一条错误消息 lua:76:当世界被锁定并处于中间时无法调用 physics.addBody()数字运算,例如在碰撞事件中为什么?
function CreeNiveau()
print("Crée le Niveau 1 ")
local lig,col ,x,y
local largeurColonne = (display.actualContentWidth/(5+1))
x = display.screenOriginX + largeurColonne
y = display.screenOriginY + 100
-- si une cible et toucher la Remove et donne des point
local function onToucheCible(self, event)
if event.phase == "began" then
audio.play(sonBump)
self:removeSelf()
AjouteScore(25)
nbCible = nbCible - 1
print("Nombre de cible restent", nbCible)
if nbCible == 0 then
Recible()
end
end
end
for lig = 1,6 do
for col = 1, 5 do
local cible = display.newCircle(x,y, 8)
-- couleur des cible
cible:setFillColor(1,math.random(),math.random())
physics.addBody( cible, "static", { density = 1, friction = 0.3, bounce = 0.6, radius = 8})
cible.collision = onToucheCible
cible:addEventListener("collision")
globaleview:insert(cible)
x = x + largeurColonne
end
y = y + 50
x = display.screenOriginX + largeurColonne
end
您可能在碰撞侦听器中使用了物理学 functions/APIs。使用timer.performWithDelay
延迟执行Recible
函数:
local function onToucheCible( self, event )
if event.phase == "began" then
audio.play( sonBump )
self:removeSelf()
AjouteScore( 25 )
nbCible = nbCible - 1
print("Nombre de cible restent", nbCible)
if nbCible == 0 then
timer.performWithDelay( 50, Recible )
end
end
end
阅读更多:
当我的球击中但 30 个目标时 30 个新的 returns 除了我有一条错误消息 lua:76:当世界被锁定并处于中间时无法调用 physics.addBody()数字运算,例如在碰撞事件中为什么?
function CreeNiveau()
print("Crée le Niveau 1 ")
local lig,col ,x,y
local largeurColonne = (display.actualContentWidth/(5+1))
x = display.screenOriginX + largeurColonne
y = display.screenOriginY + 100
-- si une cible et toucher la Remove et donne des point
local function onToucheCible(self, event)
if event.phase == "began" then
audio.play(sonBump)
self:removeSelf()
AjouteScore(25)
nbCible = nbCible - 1
print("Nombre de cible restent", nbCible)
if nbCible == 0 then
Recible()
end
end
end
for lig = 1,6 do
for col = 1, 5 do
local cible = display.newCircle(x,y, 8)
-- couleur des cible
cible:setFillColor(1,math.random(),math.random())
physics.addBody( cible, "static", { density = 1, friction = 0.3, bounce = 0.6, radius = 8})
cible.collision = onToucheCible
cible:addEventListener("collision")
globaleview:insert(cible)
x = x + largeurColonne
end
y = y + 50
x = display.screenOriginX + largeurColonne
end
您可能在碰撞侦听器中使用了物理学 functions/APIs。使用timer.performWithDelay
延迟执行Recible
函数:
local function onToucheCible( self, event )
if event.phase == "began" then
audio.play( sonBump )
self:removeSelf()
AjouteScore( 25 )
nbCible = nbCible - 1
print("Nombre de cible restent", nbCible)
if nbCible == 0 then
timer.performWithDelay( 50, Recible )
end
end
end
阅读更多: