random infinte object

hello , i need to make a physics object to fall down with infine … and randomly at the same time

using a loop …to be infinite … and a physics to fall down … and randomly

so anyone help me with a code plzz ? [import]uid: 96162 topic_id: 36242 reply_id: 336242[/import]

You should definitely take a look at the “crates” sample code in the CoronaSDK application directory. I think it will be very illuminating for you. Also take a very good look at the Code Exchange and Documentation section of this website - there you will find plenty of examples of what you want to do.

“for” loop:
[lua]
for i=1, 10 do
print(i)
end
[/lua]

Random number generator:
[lua]
print(math.random(1,1000)
[/lua]

Adding physics to an object:
[lua]
physics.addBody(obj)
[/lua]

Timer to run infinitely:
[lua]
timer.performWithDelay(2000,someFunction,0)
[/lua]

Example code to create infinite randomly falling squares at the top of the screen:
[lua]
require(“physics”)
physics.setGravity(0,10)
physics.start()

local function newSquare()
local rect = display.newRect( math.random(0,display.contentWidth), 0,100,100 )
physics.addBody(rect)
return rect
end

timer.performWithDelay(2000,newSquare0)
[/lua]

References:
http://www.coronalabs.com/resources/tutorials/all-corona-sdk-tutorials/?category=basics
http://developer.coronalabs.com/content/introduction
http://docs.coronalabs.com/api/library/math/index.html
http://docs.coronalabs.com/api/library/timer/index.html
http://docs.coronalabs.com/api/library/physics/addBody.html [import]uid: 8271 topic_id: 36242 reply_id: 143949[/import]

You should definitely take a look at the “crates” sample code in the CoronaSDK application directory. I think it will be very illuminating for you. Also take a very good look at the Code Exchange and Documentation section of this website - there you will find plenty of examples of what you want to do.

“for” loop:
[lua]
for i=1, 10 do
print(i)
end
[/lua]

Random number generator:
[lua]
print(math.random(1,1000)
[/lua]

Adding physics to an object:
[lua]
physics.addBody(obj)
[/lua]

Timer to run infinitely:
[lua]
timer.performWithDelay(2000,someFunction,0)
[/lua]

Example code to create infinite randomly falling squares at the top of the screen:
[lua]
require(“physics”)
physics.setGravity(0,10)
physics.start()

local function newSquare()
local rect = display.newRect( math.random(0,display.contentWidth), 0,100,100 )
physics.addBody(rect)
return rect
end

timer.performWithDelay(2000,newSquare0)
[/lua]

References:
http://www.coronalabs.com/resources/tutorials/all-corona-sdk-tutorials/?category=basics
http://developer.coronalabs.com/content/introduction
http://docs.coronalabs.com/api/library/math/index.html
http://docs.coronalabs.com/api/library/timer/index.html
http://docs.coronalabs.com/api/library/physics/addBody.html [import]uid: 8271 topic_id: 36242 reply_id: 143949[/import]

You should definitely take a look at the “crates” sample code in the CoronaSDK application directory. I think it will be very illuminating for you. Also take a very good look at the Code Exchange and Documentation section of this website - there you will find plenty of examples of what you want to do.

“for” loop:
[lua]
for i=1, 10 do
print(i)
end
[/lua]

Random number generator:
[lua]
print(math.random(1,1000)
[/lua]

Adding physics to an object:
[lua]
physics.addBody(obj)
[/lua]

Timer to run infinitely:
[lua]
timer.performWithDelay(2000,someFunction,0)
[/lua]

Example code to create infinite randomly falling squares at the top of the screen:
[lua]
require(“physics”)
physics.setGravity(0,10)
physics.start()

local function newSquare()
local rect = display.newRect( math.random(0,display.contentWidth), 0,100,100 )
physics.addBody(rect)
return rect
end

timer.performWithDelay(2000,newSquare0)
[/lua]

References:
http://www.coronalabs.com/resources/tutorials/all-corona-sdk-tutorials/?category=basics
http://developer.coronalabs.com/content/introduction
http://docs.coronalabs.com/api/library/math/index.html
http://docs.coronalabs.com/api/library/timer/index.html
http://docs.coronalabs.com/api/library/physics/addBody.html [import]uid: 8271 topic_id: 36242 reply_id: 143949[/import]

You should definitely take a look at the “crates” sample code in the CoronaSDK application directory. I think it will be very illuminating for you. Also take a very good look at the Code Exchange and Documentation section of this website - there you will find plenty of examples of what you want to do.

“for” loop:
[lua]
for i=1, 10 do
print(i)
end
[/lua]

Random number generator:
[lua]
print(math.random(1,1000)
[/lua]

Adding physics to an object:
[lua]
physics.addBody(obj)
[/lua]

Timer to run infinitely:
[lua]
timer.performWithDelay(2000,someFunction,0)
[/lua]

Example code to create infinite randomly falling squares at the top of the screen:
[lua]
require(“physics”)
physics.setGravity(0,10)
physics.start()

local function newSquare()
local rect = display.newRect( math.random(0,display.contentWidth), 0,100,100 )
physics.addBody(rect)
return rect
end

timer.performWithDelay(2000,newSquare0)
[/lua]

References:
http://www.coronalabs.com/resources/tutorials/all-corona-sdk-tutorials/?category=basics
http://developer.coronalabs.com/content/introduction
http://docs.coronalabs.com/api/library/math/index.html
http://docs.coronalabs.com/api/library/timer/index.html
http://docs.coronalabs.com/api/library/physics/addBody.html [import]uid: 8271 topic_id: 36242 reply_id: 143949[/import]