I have a spawn function that spawns scooters that travel across the screen left to right, at various heights. Up until now, every scooter that spawns uses the same display image (a red scooter), but I have since created art assets for several more scooters, and I want my spawn function to spawn these new scooters (chosen at random) as well. How would I go about doing this? Any help would be much appreciated. Here is my spawn function:
local function scooterSpawn (event) local scooter = display.newImage("red scooter.png") scooter:addPhysics(physics,'dynamic',{}) scooter.x = -100 scooter.y = math.random(120,924) physics.addBody(scooter,"dynamic",{isSensor = true}) scooter.isSensor = true transitions[#transitions + 1] = transition.to(scooter, {time = math.random(1400,1500), delay = 0, x = scooter.x + 968, onComplete=function() scooter :removeSelf() end}) spawnedGroup:insert(scooter)end[/code]Thank you,Steven [import]uid: 79394 topic_id: 16054 reply_id: 316054[/import]
