An attempt to teach myself the python scripting language by making a simple game on the Blender Game Engine. The game is a top down, tank game similar to the tank game featured on Wii Play.
A .Blend is included in this repository along with all the code I've written so far. To run the game in blender, download the entire contents of this repository and run tankbot_test.blend (requires blender 2.6+). Turn on layers 1 and 11 in each level scene, change the active scene to 'Menu', go to the render options tab in the properties menu and click on the 'Start' button under the Standalone player section. The game performs best in fullscreen mode. If you don't have blender installed but still want to play TankBot, a .zip containing a .exe and all required files can be downloaded on TankBot's IndieDB page here: http://www.indiedb.com/games/tankbot/downloads.
Controls: WASD to move the tank, mouse to aim, left mouse button to fire. Your rockets will bounce off walls once. One hit kills.
About the Code: (NOTE: I'm using Blender 3D's game engine to create this game so many of the functions used are exclusive to Blender) Player.py is where all of the logic for the player is stored. Likewise, Enemy.py is where all logic for the enemy tanks is stored. This includes pathfinding, which I've accomplished using navigation meshes and simple follow/flee behaviors. Game.py contains the main logic for the game, or the main game structure. This is where I handle switching levels, gameovers, camera motion, etc. The majority of the code here is attached to the camera objects of each scene. Finally, Menu.py is where the button class is kept, along with all of its different button functions.
About the Game: I'm learning python as I go so the first bit of code I wrote, the player's code, is more primitive than the latest code (although not by much). I've noticed I tend to rely on if/then statments for almost everything and I'm afraid this might limit myself or the game in the future. I've turned all of the code for the menu buttons in the game into one "Button" class with different functions for each button. It might not have been the most practical use of classes I could have done for this project, but it did teach me about them, which is the ultimate goal. I've since made an Enemy class to handle all enemies.
About this Repository: I've started using this repository as a complete back up of all my game files, which means I no longer have to worry about the safety of my game if my computer crashes or is stolen or spontaneously combusts, AND that anyone with Blender installed can now download this whole repository and check out TankBot from behind the scenes. It also means that this repository just got a whole lot more cluttered, so anybody reading this who is solely interested in my python code, search through the repository for Player.py, Enemy.py, Menu.py, and Game.py.