I have a function which spawns a new platform every 1.8 seconds. I want the platform to spawn on a random y value. However I don’t know how to switch randomly between JUST two points (not 600 to 700, but 600 and 700).
Anybody know how to do this?
Here’s the code:
[code]
local function spawnPlatform()
local shortplatform = display.newImage( “DesertPlat1.png” )
shortplatform:setReferencePoint(display.BottomLeftReferencePoint);
shortplatform.x = 960
shortplatform.y = math.random (640 900)
physics.addBody( shortplatform, Platform )
shortplatform.bodyType = “kinematic”
shortplatform:setLinearVelocity( -450, 0 )
end
timer.performWithDelay( 1800, spawnPlatform, 0 ) [import]uid: 16789 topic_id: 6469 reply_id: 306469[/import]