Quantcast
Channel: Envato Tuts+ Game Development
Viewing all articles
Browse latest Browse all 728

Making Your First Game: Ernesto Quezada’s Story

$
0
0

I’m a programmer. At work I program games and – this may sound sad, but – when I come home from work, I do more programming. I love it. But this was not always the case. In fact, I never studied to be a programmer. This is the story of my first game, La Cucaracha (“The Cockroach”), and how I went from creating graphics to developing games.

It all started many years ago, while studying a degree in Graphic Design back in El Salvador…


My First Game

Find a job you love and you will never have to work a day in your life

I didn’t always know this quote from Confucius, or live my life trying to find that perfect job, but it just happened, maybe by coincidence.

There I was, a good Graphic Design student, drawing some vector insects just to learn how to use this tool called Macromedia Flash:

Insects
Cockroach and ant drawn in Macromedia Flash 5.

Right, now what? The cockroach is there, very quiet, and I just feel like squashing it! After a few clicks with the mouse, the cockroach was still there. How do I squash it? The only way was to start learning a bit of programming, just for fun.

Again, quoting Confucius:

The man who moves a mountain begins by carrying away small stones.

No, I didn’t want to move mountains, I just wanted to learn a bit of programming and I knew I had to do it step by step.

It wasn’t too hard to learn to make buttons in Flash, and that was a start. The roach was now a button and when hovering over it with the mouse, the antennae would move to the inside.

I had already learned that the internet was my friend, and that if I knew what to look for I’d find an answer. So, soon I found a script that would make insects move randomly but always facing forwards:

Object.prototype.move = function()
{
      rotAdd = (random(100 - (vita * rot)) - 50) / 100;
      rot += rotAdd;
      _rotation  += rot;
      posX = this.tempo * Math.sin((_rotation / 180) * Math.PI);
      posY = -this.tempo * Math.cos((_rotation / 180) * Math.PI);
      _x += posX;
      _y += posY;        
      if ((((_x < -20) or (_x > 550)) or (_y < -20)) or (_y > 500))
      {
          _rotation += 180;
      }
}

Don’t ask… even now I don’t understand how that ActionScript 1 code works!

But it worked, and I knew how to use it, and so I did. I added a little roach on the stage and used that script to make it move; the roach was ‘walking’ randomly. But that wasn’t what I wanted. I wanted to squash it!

As Flash is by principle an animation tool, I created an animation of a roach getting squashed and then disappearing after a second or so. Inside I added a button with instructions to make the animation play as soon as the button was clicked:

Cockroach animation keyframes
Cockroach animation keyframes.

The animation looked like this:

Squashed Roach
Squashed roach animation

Squashing the roach was somehow fun so it suddenly became a game! I hadn’t meant to make a game, though, I just wanted to squash a cockroach. I added five little roaches on the stage, all of them using the same script to make them move randomly, and resetting their position if squashed; I changed the mouse cursor and added a score.

The game was still a bit boring, it needed a ‘challenge’ – and that was when La Cucaracha was born. The idea was that the player could click on the little roaches to get rid of them, but not on a big one which was in fact a ‘mouse trailer’, following the player so the player had to ‘run away’ from it, otherwise the player would die.

Again, it was easy to find ‘mouse trailer’ scripts online, but none of them would do what I wanted. The roach should point at the mouse while moving towards it. I found scripts that would rotate towards the mouse using trigonometry; even though I didn’t even know what trigonometry was, I knew some magic Math.atan() code would do the job, but making a mouse trailer that would rotate towards the mouse was a different story. I had to ask for help in a Flash community forum called FlashArgentina and eventually I got the script I was after.

This was the initial ‘game’ I made, back in early 2002:

name="src" value="http://cdn.tutsplus.com/gamedev.tutsplus.com/authors/ernesto-quezada/cucaracha.swf" />

I got some really nice feedback from friends and family (they usually give positive feedback anyway) which encouraged me to continue learning ActionScript. The ‘game’ was part of the examples from that community and I quite liked the idea of creating more files to showcase.

I continued studying Graphic Design and, of course, learning ActionScript in my spare time. I had already started getting hooked on programming.


Flipping the Coin

One day I was offered to come to London to study English. I knew it would help me a lot in understanding programming, since programming concepts and keywords are in English and as there were many more books and tutorials in English than in my native tongue, Spanish, so I left my studies unfinished and moved countries. No more Graphic Design for me.

Once in London, the first thing I did when I got a computer was to install Flash. I continued learning ActionScript and obviously making more small games.

In 2005 I studied a Masters in Digital Media. One of the subjects was Principles of Game Design, where I learned many things – like how a game needed a story, sounds, menu, instructions and power-ups.

I decided to apply all these new concepts into La Cucaracha and re-coded it in ActionScript 2. I re-released it after joining MochiAds back in 2007 just to test their service.

The MochiAds version of the game has been played more than 1.5 million times and I’ve earned a few hundred dollars from it – not bad for a quick game that I made just because I wanted to squash a vector drawn cockroach!

Here it is, the revamped version of my very first game:

LaCucaracha
Click to play La Cucaracha in a new window. (Warning: Sound!)

I must admit, many people don’t understand it on their first play-through; they need to play it a couple of times before realizing they have to run away from the big roach. That’s bad design on my part and it’s very important to take into account that if a player doesn’t get what your game is about, they will move to play some other game straight away. I always wanted to release a new version of it, with more lives, different power-ups, even different levels and definitely different sounds and graphics… maybe one day.

Anyway, continuing with the story, after finishing my degree I started working as a programmer, professionally I don’t do any graphics whatsoever, and when applying for jobs I always show my beloved game La Cucaracha as it’s an important part of my portfolio. But I hope I won’t be showing my first game at any interview any time soon as I’m not planning on moving jobs at all – like I said at the beginning, I don’t work, not in the sense that I’m jobless but because I just love what I do.


Conclusion

If you would like to make games, give it a go – it might just change your life.

You might not like it, but you might love it, and if that’s the case, chances are that you will be making games for a living. You’re in the right place to make a start, just check out other articles here on Gamedevtuts+. In fact, you’re in an even better position today than I was when I started: these days there are many more articles, books, tutorials, and gamedev tools, and the internet is much faster so you have the advantage of video tutorials too.

Always keep in mind what Confucius said:

It does not matter how slowly you go as long as you do not stop.


Viewing all articles
Browse latest Browse all 728

Trending Articles