12/11/22 Random platforms


Today’s objective was to create randomly spawning platforms after another platform leaves the screen.

I have removed player collisions with the world bounds and added a kill condition if the player is pushed off the left side of the screen.

In this code I have used the variable “previousy” to calculate where the next platform should appear, and then used this coordinate in the creation of a new platform each time one disappears.

The result is slightly random platforms like this:


Leave a Reply

Your email address will not be published.