Monday, May 11, 2009

The First Step


So i've been thinking of taking up game programming for quiet a while, and i decided to write a simple game in allegro just to start things out. Allegro is a free game programming library which is good for beginners. I really did not want to think of an idea, as I was more focussed on the game design/structure rather than the game idea. I chose to make the snake game. It seemed a simple, yet an addictive game.

At first, I tried making it on my own. The basic idea was simple, I would be having 3 files, one of them a header file containing the declaration of the classes 'snake' and 'food'. Another one would contain the definition of the functions of these 2 classes, and finally, the main file. However, I soon learnt that it was causing a lot of problems. I needed 1 file for each class. Also, I really couldn't figure out how to get the snake to move. I looked for some examples on the internet, and I found some really cool ideas. One of them was to keep adding a pixel in front of the snake, and deleting the one at the tail. Also, I would be needing 2 variables. Also, i needed a variable to store the direction of the front as well as the tail.

However, I still don't get how I am supposed to know when to change the direction of the tail. I'm stil working on it. Hell, who am I kidding. I spend most of my time watching How I met your mother, the IPL or on Facebook. The holidays are not the right time for work, it seems. Maybe the internship will put some discipline into me.

Well, keep visiting this blog for more updates on my game. My aim is to finish it off before the end of this month.

No comments: