Spawn

How can I spawn a object randomly every so often from the top of the screen?

Randomly pick an x position, set y to the value of the top of screen plus your object height…and add a timer to create a new item. Put it in a table and in the draw() loop, for() the table, drawing as needed.

ElapsedTime is a suitable timer