Missions‎ > ‎

Mission 2.3

Programming games is no joke.  It requires lots of different skills and resources.  Think about your favorite games: someone had to write the story, draw the art, animate the movement, compose the music, and of course, program how everything on the screen behaves.  EVERYTHING.  It takes a lot of time and work to set up, but if you're willing to go for it, you can make something awesome!

We're going to be using the Tutorials at Ruby4Kids.com.  This Mission has lots of parts, so I broke it up a bit.

Here are your steps to get started
  1. Tell Mr. Dreyfus you want to follow the Ruby4Kids tutorial.  He needs to sign you into an administrator account so you can install some of the tools that tutorial requires.
  2. Go to the screencasts on Ruby4Kids.com. Note: I found that these didn't play in Chrome.  Try Safari if you have the same problem.
  3. Follow the first screencast, "Pre-Requisites."  Where he says to get out your Mac OSX disk and install Xcode, you can skip that part completely.
  4. Do everything else in that first screencast like the guy says.  A little explanation here: The next command is sudo gem install gosu.  Let's break that down:
    • sudo - This is short for Super User Do.  This says to your computer, "hey, I know I'm doing something dangerous here, but it's okay, because I'm a Super User."  To use this command, you need to be an administrator, and you may be asked for the admin password.  That's why you need Mr. Dreyfus to log you in.
    • gem - Programming languages like Ruby are great for general-purpose programming, but there are lots of more specific things you might want to do with them, like make games with graphical interfaces.  For these more specific things, there are libraries; collections of code that let you use their own special commands.  Ruby libraries are called gems. Cute, huh?
    • install - You're going to download and install a gem from rubygems.org, a website that hosts thousands of different Ruby libraries.
    • gosu - Gosu is the name of the gem we're installing.  Hey look, Gosu has a website, too!
  5. Log out of the admin account and go back to your own.  Now everything should work for you.

Start creating your game
  1. Go to the screencasts on Ruby4Kids.com.  In Lesson 1, the teacher uses Textmate.  As his text editor (a program for writing code).  Textmate is expensive, so you should use TextWrangler, which is already on your computer.  At home, you can download it from here for free: TextWrangler.  Open it and install the Command Line Tools before continuing.
  2. Start Lesson 1 - Draw a window and a player.  
    • The fact that we're using TextWrangler makes a small difference here. When he uses the command  "mate ." to open a directory in Textmate, you will use "edit ." 
    • He forgets to mention that you need to keep SAVING YOUR FILES.  Whenever you try to run your game, you have to save first or your changes won't be shown.
  3. Do all the lessons!  At the end of each Hackers meeting, meet with Mr. Dreyfus to get a bit more understanding about how the code works and how it all fits together.  By the end, you'll have a game!

Package it

Hack it

At this point, you should have a fully functioning game.  If you really understand how all the parts work, you should be able to hack it to make minor changes.  For example, try this: instead of having the balls drop from the top of the screen, can you make them run from left to right?  You'll probably want to make the game window wider, too.