HI all! I can’t figure out how to end/stop calling a function.
So here’s an example
[lua]–spawns a function, adds physics to the object, adds a velocity function
function sp ()
for s = 1, 1 do
p = display.newImage(“platform_1.png”);
p.y = 690
physics.addBody( p, “kinematic”,{density = 1, friction = 0.3, bounce = 0.0} )
p.isFixedRotation = true
– moves the image upwards
Velocity ()
end
end
end
–starts the spawning process
local spawnImage = timer.performWithDelay( 5000, sp, 0 )
– velocity function/sets speed of p
function Velocity ()
p:setLinearVelocity( 0, -200 )
end [/lua]
I want this function to go on forever unless an event is triggered.
And I want all the images that the function creates to remove themselves once they move off the screen.
so how do you end these functions/stop calling them and how do you remove the images that it’s creating after they move off the screen?
thanks in advance!
[import]uid: 70979 topic_id: 12619 reply_id: 312619[/import]
