I have a function that spawns scooters zipping across the screen left to right, at various heights. Currently, the most recently spawned scooter will always display over-top of previously spawned scooters, but this isn’t what I want.
What I want is for the height of each scooter to determine it’s hierarchy in terms of which object displays on top. I want the scooters lowest on screen to overlap the scooters highest on screen. The purpose of this is to simulate a top-down 3/4 perspective (like looking down at a target-range where the targets slide back and forth at various distances).
Does anybody have any ideas on how I could accomplish this? Here is my code for my spawn function:
local images = {} images[#images + 1] = 'Red Scooter'images[#images + 1] = 'Blue Scooter'images[#images + 1] = 'Green Scooter'images[#images + 1] = 'Yellow Scooter'local function scooterSpawn (event)local index = math.random( 1, #images )timers[#timers + 1] = timer.performWithDelay(math.random(30,45),scooterSpawn) local scooter = scooterFactory:newSpriteGroup( images[index] ) scooter:play( images[index] ) scooter.x = -100 scooter.y = math.random(80,884) transitions[#transitions + 1] = transition.to(scooter, {time = math.random(2000,2500), delay = 0, x = scooter.x + 968, onComplete=function() scooter :removeSelf() end}) spawnedGroup:insert(scooter)end [/code]Any help would be much appreciated.Thank you,Steven [import]uid: 79394 topic_id: 16221 reply_id: 316221[/import]
[import]uid: 3826 topic_id: 16221 reply_id: 60398[/import]
[import]uid: 39846 topic_id: 16221 reply_id: 102248[/import]