Monkey Game Development:Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Chapter 2. Getting to Know your Monkey—a Trip to the Zoo

Phew, there was a lot of dry and general information in the first chapter! As I told you, you could have skipped the chapter if you already knew about all that it covered. Anyway, it is time now to become a little bit more practical, and so we should get down to business.

Assuming that you already have Monkey installed on your machine, we will work together through some Monkey game development basics. We won't go through every Monkey command as it is shipped with good documentation. There is no need to repeat everything again, here. Anyway, I am right behind you!

So, in this chapter, we will learn the following:

  • How to load a script
  • About projects and how we can create one
  • The basic structure of a simple game
  • How to draw circles and rectangles
  • How to read keyboard input
  • How to print messages to the browser window
  • How to export your game to HTML5 and run it inside a browser

Quite some stuff, isn't it? Hopefully the page limit for this chapter will be enough for it. So let's get on with it!

At first, we will experiment with Monk a little bit, by creating a project. Then, you will write your first lines of Monkey code, a typical Hello World app. And of course how to save your code and reopen it at a later point.

Of course, you will have to create your first little game, PONGO—a very simple one, but a game in all its glory. You want be a game developer, right? So you've got to do what a game developer has to do. Together, we will recreate one of the first video games in history, Pong. Never heard about it? As always, look at this Wikipedia page to get an idea about Pong: http://en.wikipedia.org/wiki/Pong.

As a game developer, you have to start small, and this game is the perfect ground to build up your development skills with Monkey.

After we are finished with the development of the little game, you can call yourself a Monkey programmer! You don't think so? Yes you are! You learned to walk, and now we will learn how to run. And as they say, practice makes perfect. The best way to learn is by creating some nice little games. So let's get down to business, shall we?