BlockDefence Game Project

I stared at a sheet of paper which had the words “Bucket List” written on it. I recall writing this list many years ago. As I scanned through the items on this list, I made an observation. What fascinated me in the past and what fascinates me now are almost two separate lists. However, I did find an item on that list that kept the past list and the current list from being true binary.

This one item caught my attention as I knew that I was capable of doing it. The item read, “create my own video game.” As I read those words, I got really excited. At this time, I had programmed in Python for six months and have dabbled in Pygame, one of Python’s game libraries. So, I decided to set out to create my own video game!


Before we get into the good stuff, I would like to take a moment to explain why a goal can’t be achieved by ambition and excitement alone…

One has to know the scope of a project before they take it on!

To elaborate, one should develop the skill set necessary to complete the tasks they will tackle. They should also be willing to put in the effort to grind out solutions, even if the solutions go against best practices.

The Process

To start, I decided to create a tower defence game. If you don’t know what a tower defence game is, check out the tower defence wiki. This type of game allowed me as the developer to set up the main portions of the game fairly easily. It also got me to focus on getting the game to completion.

First Attempt

Now, the first attempt (yes, there were multiple attempts!) at coding the game went quite well. I designed all of the screens and came up with the plan for how the game was going to be played. I even decided to have blocks for all the game’s sprites! Amidst all of the progress, there were a few problems that paused the game’s development.

The first problem I encountered was that I really didn’t know how to create sprites. I looked through tutorials, but my problem was quite specific. I found out that regular sprite interaction executes differently in different situations. For example, defining a sprite’s action in a function is not the same as defining it in a class method. So, I decided to do some research before I continued with the project.

As I researched, I went on with other facets of the game and encountered another problem. The code I was writing at the time became illegible. When I took breaks, it took me a few hours to understand what I was reading. After a few days of this, I stopped developing the game. I couldn’t follow the code I wrote!

Second Attempt

A few months passed and I learned how to manage large amounts of code. I knew how to break up a program (or game) into smaller, more manageable chunks of data. I stored each class in its own file and grouped images and related files together. I also learned how to reduce code redundancy while avoiding the hard coding of variables.

Armed with the above skills, I set out once again to code my tower defence game. I created a new project folder and started coding the game from scratch. Of course, I reused some of the code that was essential (button and text functions). It only took me a few days to get back up to where I left off.

Overall, it took me a few weeks to get the game to completion. The sprite interaction took the longest to develop as was expected. After this was accomplished, Block Defence version 1.0.0 was released!

As of this writing, I have plans to improve the gameplay based on the third understanding I learned from the development process (see my post Experiences with Video Game Development for context).

The Game

The goal of the game (as of this writing) is to complete all 10 levels without dying.

How To Play

The player buys block towers which have specific range and damage parameters. There are four types of blocks: green blue, yellow, and purple.

The player can only place their towers on the red portions of the map (the white portions are reserved for the enemies).

Once the player clicks the “Start” button, the enemies will start to spawn from the top-right portion of the map. They will move around the map moving towards the bottom-left portion of the map.

If an enemy gets to their target, you will lose a life and they will despawn. If you run out of lives, you lose!

Summary

Block Defence was a great project to code and I enjoyed bringing it to completion. Looking at the bigger picture, the game was a milestone and a big step towards more game development endeavors.

If you would like to try the game out for yourself, go to the Block Defence repository and follow the README.md installation instructions.

I look forward to hearing about your experiences with the game!

Do you have any suggestions or improvements for the game? Would you be interested in other games by the same developer? Got an idea for a game that you want developed? Leave your comments below!

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments