Add Moving Platforms

Moving platforms make your game more interesting and challenging. They require the player to think ahead and try to predict where the platforms will be when Chip reaches them. Some of the platforms will move side to side, and some will move up and down.

Adding moving platforms to your physics game requires a little creativity. Platforms that move like these don’t really occur in nature. You could just move them yourself by changing their position, but the result wouldn’t be good. They wouldn’t interact correctly with the player and the boulders. Instead, place them in the space and figure out what forces are needed to hold them up and move them back and forth. Then, you cheat the physics engine just a little to keep them ...

Get Learn Game Programming with Ruby now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.