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
I have the same problem. I have an object shooting up from the bottom of the screen and would like it to shoot some bullets in random positions or time but I am not able to solve it. Any ideas? [import]uid: 22737 topic_id: 6469 reply_id: 22395[/import]