Certainly. Look at the “CloudLevels” tab in the Lua Jump example, specifically the generatenextCloud routine - it sets the cloud’s position, then sets nextCloudHeight to that position plus a random number.

As for using a sprite, you’d replace the part of Cloud:draw() that draws the clouds - the two “for” loops - with a call to draw a sprite or sprites.

Go ahead and try it! The examples are read-only, you can’t break anything, and tweaking them and seeing the results when you run the program is an excellent way to learn.