2014-12-01 3 views
0

아래 코드를 작성하여 애니메이션과 오른쪽에서 왼쪽으로 이동하는 선을 만들었습니다. 내 문제는 그 선이 더 이상 스프라이트 아래에 없다면 스프라이트가 떨어지지 않는다는 것입니다.(CORONA SDK) 스프라이트 애니메이션이 넘어지지 않음

local sheet1 = graphics.newImageSheet("hero.png", { width=135, height=259, numFrames=14 }) 
local hero = display.newSprite(sheet1, { name="hero", start=1, count=14, time=450 }) 
hero.timeScale = 1.0 
hero.x = _W/2-400 
hero.y = _H/2+180 
hero.alpha = 1 
hero.myName = "hero" 
hero:play() 
physics.addBody(hero, "dynamic", { friction=0.0, bounce=0 }) 
hero.isFixedRotation=true 


local linea = display.newRect(_H/2,math.random(_H/2+290,_H/2+400),1250,10) 
linea:setFillColor(255,0,0) 
linea.alpha = 0.5 
linea.myName = "linea" 
physics.addBody(linea, "static", { friction = 0, bounce = 0 }) 


local function muoviLinea() 
    linea.x = linea.x - velocita 
    linea2.x = linea2.x - velocita 

    if(linea.x<-712)then 
     linea.x = _W/2 
     linea.y = math.random(_H/2+290,_H/2+400) 
    end 
end 


Runtime:addEventListener("enterFrame", muoviLinea) 

경우, 대신 스프라이트의, 나는 그것을 정상적으로

local hero = display.newRect(100,100,10,10) 
physics.addBody(hero, "dynamic", { friction=0.0, bounce=0 }) 

모든 작품 사용합니다.

내가 뭘 잘못하고 있니? 고맙습니다.

답변

0

명시 적으로 시작하지 않으면 모든 물리학이 시작되지 않습니다.

관련 문제