Make an Empty Window
Each game you’ll write starts by opening a window on your screen. That window is where you’ll bring your games to life, drawing images and making them move. Gosu provides you with a class for drawing that window, called Gosu::Window. This class does more than just draw the window; it also provides methods that give structure to your games. Each time you write a game, you’ll start by creating a subclass of Gosu::Window. For your first game, that subclass will be called WhackARuby.
To create this class, make a new folder called WhackARuby, inside the Games folder you made in Organize Your Workspace. Using your text editor, make a new file and save it in that folder with the name whack_a_ruby.rb.
To use its classes in ...
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.