Hey you, a very welcome to this post. Hopefully, you are safe and doing well. In this project, I made a basic Space Ship game using
pygame
module of python. Let me describe how I managed all those stuff!
How the idea came
The first aim behind this project was to learn python. As a prerequisite, I just learn the basics of python and then ask myself to build something through which I can implement these skills. So, after searching for various projects for new learners, I decided to go for a basic small-scale space ship game development.
Overview of the Game
In this space game, we will have a space ship and some enemies will move in the screen from left to right and when they come to the rightmost area, they will quickly come downwards for a certain distance and then start moving from right to left. The opposite rule goes for the movement from right to left. Our spaceship can only move right and left by pressing the arrow keys or "D" or "A" from the keyboard. We can also shoot by pressing Spacebar. If any enemy can reach a certain red line then the game will be over.
Here is the preview of the game
Brief mechanism of the Game
There are some steps I had to follow to make this game
- Make the basic movements of the player, i.e. on pressing the "A" or left arrow key, the player will move towards the left and vice versa for the "D" or right arrow key
- Write logics for boundary conditions for the player
- Generate the enemy in the random position on the upper side of the window
- Write logics for its movement as well as those situations when it will reach the end position.
- Then I wrote the logic of ending a game and how the score will be counted
- After that, I implemented the logic of firing the bullet
- Lastly, I did the collision logic
And, that's all. Here is the GitHub link to the project ๐ค
Conclusion
After successfully completing this project, I have made a downloadable Windows version of this project. You can download the Windows version from here.
Thanks for reading, and if you want to connect with me, here are the ways: