In the last 2 weeks of December 2017, I challenged myself to code a game similar to the popular mobile video game, Clash Of Clans. And by 30th of December 2017 I completed this game and am here to share it with you guys!
Battles in completely coded using PyGame library in Python 2.7.
Not familiar with Clash Of Clans? Clash of Clans is a freemium mobile strategy video game developed and published by Finnish game developer Supercell. The game was released for iOS platforms on August 2, 2012, and on Google Play for Android on October 7, 2013.
The game is set in a fantasy themed persistent world where the player is a chief of a village. Clash of Clans tasks players to build their own town using the resources gained from attacking other players through the game’s fighting features. The main resources are gold, elixir and dark elixir. Players can conjoin to create clans, groups of up to fifty people who can then partake in Clan Wars together, donate and receive troops, and talk with each other. [Source: Wikipedia]
You can download the game here : CoC for Android, CoC for iOS
About Battles Battles allows you to attack predefined bases with fixed troops. The troops gets unlocked and the level increases automatically as you progress through the game. Also the Defense Structures gets unlocked and the level of structures increases as well! The most important Building is the “Headquarters” which is a pentagon shaped building usually in the middle of the base. Destroying HQ will earn you 1 star. If your damage percent crosses 50%, you will be rewarded another star and finally destroying everything will reward you another star!
Troops Troops that are available are : Shooters (Levels 1-5), Tanks (Level 1-4) and Helicopter (Level 1-3). My personal favorite is the Level 3 Helicopter!
Shooters Level 1 – 5
Tanks Level 1 – 4
Helicopters Level 1 – 3
Defense Structures and Other Buildings Structures in the Base : Cannons (Level 1-4), Mortars (Level 1-3), Towers (Level 1-4) and Headquarters (Level 1 – 5)
Cannons Level 1 – 4
Mortars Level 1 – 3
Towers Level 1 – 4
Headquarters Level 1 – 5
Creating Maps and Custom Mode You can create your own maps with different levels of buildings and attack on them in custom mode! Where you have access to any level of troops you like!
Here are some game play screenshots:
This slideshow requires JavaScript.
The Code The entire code of the game is divided into 4 Libraries : Troops.py, Structures.py, GUI.py and Maps.py. And these libraries are called in Battles.py. You can find the entire code to the game in my GitHub Repository whose link is given below. You can also download the game (in .exe form i.e., ready to go application) which also uploaded in the repository.
Link to code: GitHub Link Link to Video: Video on YouTube
Let me know your thoughts in the comment section below and if you enjoyed the game or learned something new, like and share this because this is what keeps me going!
And finally I am going to start my this years challenge, #CodingOf218 from 7th of January! If you too have made this your 2018’s challenge let me know by tweeting with #CodingOf218 hashtag in your tweet!
You May Also like :
Explorers – Using Genetic Algorithm
#CodingOf218
Programming Languages – 2017
Stacks in Python Using PyGame
#CodingOf208 – Ends!
8 Ball Pool in Python
Battles – Game inspired by Clash Of Clans In the last 2 weeks of December 2017, I challenged myself to code a game similar to the popular mobile video game, Clash Of Clans.









