Director class help

I have created menus for my game, but i have on problem again. When level starts, ball (pallo2) gets linear impulse. I have used Runtime:addEventListener("system",moveball) code to start impulse, but "system" doesnt work anymore with director class. So can somebody help me, that ball gets impulse when level starts.
Here is my code:

1
2
3
4
5
function moveball()
   pallo2:applyLinearImpulse( 0.1, 0.2, pallo2.x, pallo2.y )
end
 
Runtime:addEventListener("system",moveball)

1
2
3
4
5
function moveball()
   pallo2:applyLinearImpulse( 0.1, 0.2, pallo2.x, pallo2.y )
end
 
Runtime:addEventListener("enterFrame",moveball)

No it doesnt work. Now it gets impulse all the time. I want to, that it gets only one impulse, when level starts.

How about just call the function moveball() just below the function with no event listener then it'll just get called when the level starts.

Thanks for advice. I removed fucntion part and just used pallo2:applyLinearImpulse( 0.1, 0.2, pallo2.x, pallo2.y ) to get impulse. Now it works perfectly. I am new to corona, so i am still learning.

views:1274 update:2011/10/13 9:25:17
corona forums © 2003-2011