if ( rand(1000) == 7 )
@balls.pop = Ball.new
end
This isn't really time based, but it kind of acts like it.
The way to do this with time is have an instance variable (starts with @) in the initialize method, then add more balls as the time passes.
The example below adds a ball every 3 seconds for example.
Alberto.
===================
def initialize()
....
@time = Time.now
end
def update
if(Time.now - @time) > 3 #if 3 seconds have passed
@balls << Ball.new
@time = Time.now #reset the time
end
end