O'Reilly logo

Learn Game Programming with Ruby by Mark Sobkowicz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Place Platforms Randomly

In the first version of Escape, we placed the platforms ourselves, by specifying the position of each one. This meant every time someone played the game, the platforms were in the same spots. This is not necessarily a bad thing, because you can design the pit to be just as difficult as you like. In this version, try another strategy and place the platforms randomly. The three pictures that follow do not show the actual placement of platforms in the game. They help explain what you are doing in the calculations that actually place the platforms.

images/sidescroller/grid_1.png

To place the platforms randomly, while still making the game playable each ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required