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

Move the Ship

The player moves the ship by pressing three keys. Gosu treats keys exactly the same as mouse buttons and calls all of them buttons. You use the left arrow, the right arrow, and the up arrow to move the ship. The ship moves forward by firing its engines; the ship doesn’t have any way to fire the engines backward. If you stop firing the engines, the ship coasts gradually to a stop.

Of course, this isn’t actually realistic, but our primary goal is to make the game fun. Sometimes realistic is fun, and sometimes realistic is just frustrating. Our job as game designers is to strike the right balance. In this game, we want moving the spaceship around to be fun. We use some ideas from physics to make the ship feel like a real object ...

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