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

Use a Camera

In this new version of Escape, the pit is much bigger than your game window. You make the pit a square 1600 pixels on a side, while the window is 800 pixels square, so you see only one quarter of the game inside the window at any one time. The part of the game space you’ll show will depend on Chip’s location.

images/sidescroller/camera_window.png

It’s as if a camera is following Chip around as he climbs out of the pit. When Chip gets close to an edge of the pit, or to the top or bottom, the camera doesn’t follow him in the same way. Instead, the camera stops so that the whole camera view remains inside the pit.

The Camera Class

Start by making a copy of the Escape folder ...

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