Game in Python
This is the first project of the course Design and Analysis of Software Systems that i took in 4th semester in my college.
- The expected outcome of this project to get a good hang of OOPS concept in python, and there could be nothing better than making a game.
- The OOPS concept used in the game are :
- Encapsulation - Use of classes for designing the game ensures Encapsulation.
- Polymorphism - Use of createDragon method which is overridden by Manda and Viserion for rendering different dragons ensures Polymorphism.
- Inheritance - Use of godObject from which all the game object inherits ensures Inheritance is being taken care of.
- Abstraction - Use of private variables in the class Location ensures that unnecessary details to the outside world.
- The game should be a terminal-based Python3 game.
- The protagonist of the game is Manda living in the post-empire era. He is one of the last remaining members of his clan in the galaxy and is currently on a mission for the Guild. He needs to rescue The child , who strikingly resembles Master.
- The objective of the game is to collect as many coins as possible, fight the obstacles on the way, defeat the boss enemy and rescue Baby Yoda.
- GodObject - this is the class from which every other game object inherits.
- Location - this class is used to describe the location and size of an object.
- Person - every living character in the game inherit from this class.
- Mandalorian - this represents the main character of the game.
- Viserion - this represents the main Villian (Boss enemy) of the game.
- Game - this class controls the whole game, it has various functions to control the flow of the game.
- LargeGrid - this class represents the background grid of the game which has different object randomly generated as obstacles in the game.
- SmallGrid - this class represents the current background of the game which is loaded from the large grid.
- Screen - this class is responsible for loading and rendering the game screen at each iteration.
- Utility - this class helps to get the non blocking input from the user.
pip3 install -r requirements.txt
python3 main.py
- w for jumping up
- a for moving left
- d for moving right
- b for shooting bullets
- v for speeding up the game(for some amount of time)
- '.' space bar for obtaining the shield if it is present. It refills after fixed amount of time.
- Collect coins to increase your score.
- If the bullets hit the fire beam they(beams) are destroyed and it adds to your score.
- If the player hits the beams than his life is reduced.
- The player can take the Dragon Bonus shown by 'D' which turn him to a dragon.
- If the player hits a fire beam and he is in dragon mode than he is changed back to normal player without decreasing the life.
- The player can use the shield to protect him from obstacles.
- The magnet which appears somewhere in the middle of the game pulls the player up.
- The boss enemy appears at the end, which is a dragon and shoots Ice balls at the player which he must dodge, otherwise his life will be reduced.
- The boss enemy follows the player.
- You win the game after defeating the boss enemy and rescuing Yoda.