Back and forth movement

1
2
3
4
5
        local steel = display.newImage( "levelimages/steel.png", 57 ,30 )
        steel.x = _W/2 + 20
        steel.y = _H/2 - 25
        steel.rotation = 90
        physics.addBody( steel,"static", {friction = 0, bounce = 0}) 

transition.to is pretty good for this sort of things...

I have been trying to use that, and it has proved to be very inefficent to manage. Can you provide a basic code? It would help alot, thanks!

Here's a rough example with a circle I threw together for you;

1
2
3
4
5
6
7
8
9
10
11
12
13
display.setStatusBar(display.HiddenStatusBar)
 
local object1 = display.newCircle( 160, 50, 20 )
 
local function tDown ()
        transition.to(object1, {time=2000, y=430, onComplete=tUp})
end
 
function tUp ()
        transition.to(object1, {time=2000, y=50, onComplete=tDown})
end
 
tDown()

The example is perfect Thanks Peach!, and DarkConsoles

views:1489 update:2011/12/31 9:35:10
corona forums © 2003-2011