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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.