Hi all…
I’ve never used spawned tables before, so I feel like a bit of a noob… I’m creating an infinite runner styled thingy, so my ‘floor’ uses a lot of spawned images (that are also physics objects).
To cut a long story short, I want to scroll the floor as if it was a display group (I can’t actually move the display group as it affects the character - which I want to remain in the middle of the screen).
Can I apply a transition to the table itself, or the indexed objects within (all at once)??
At the moment, this is the core part of the code
local platform = {} for i = 1,20 do platform[i] = display.newRect( 568, 500, 50, 50) platform[i].x = (i\*50) platform[i]:setFillColor( 1, 1, 1 ) platform[i].strokeWidth = 1 platform[i]:setStrokeColor( 0, 0, 0 ) physics.addBody( platform[i], "static", { density=2, friction=0.3, bounce=0.0 } )
I simply want to perform a transition (or linear impulse / velocity ((anything really))) on 'platform[i], but I don’t know which part of the table structure to affect, for example, this won’t work:
transition.to( platform[i], { time=150, x=platform[j].x+50, y=0, } )
Help. Thanks