Need Help, wont play continuesly...

What im trying to do here is have this (grass, grass2) play (move) none stop, in another words i want to loop them together so it seems like the grass is moving, like if you where walking...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require "sprite"
display.setStatusBar( display.HiddenStatusBar )
 
local sky = display.newImage( "images/black.png" )
 
local grass = display.newImage( "images/grass.png" )
grass:setReferencePoint( display.CenterLeftReferencePoint )
grass.y = 0
grass.x = 20
grass.rotation = 90
 
local grass2 = display.newImage( "images/grass.png" )
grass2:setReferencePoint( display.CenterLeftReferencePoint )
grass2.x = 20
grass2.y = 480
grass2.rotation = 90
 
local function test()
local tPrevious = system.getTimer()
local function move(event)
 
        local xOffset = ( 0.5 * 5 )
 
        grass.y = grass.y - xOffset
        grass2.y = grass2.y - xOffset
        
        if (grass.y + grass.contentWidth) < 0 then
                --grass.y = grass.y + 100
                grass:translate( 480 * 2, 0)
        end
        
        if (grass2.y + grass2.contentWidth) < 0 then
                --grass.y = grass.y + 100
                grass2:translate( 480 * 2, 0)
        end
        
end
Runtime:addEventListener( "enterFrame", move ); 
end
 
test()

Please explain what you want to happen and what is happening, don't simply post a bunch of code with no explanation.

Sorry about that new to this...

Well you explained the first part but not the second.

views:1401 update:2011/10/5 21:23:48
corona forums © 2003-2011