## DEV Community

Karthik PM

Posted on • Updated on

# Making a game in python after my first sem of basic python programing course

code of the project: https://github.com/Karthik-PM/MyProjects/tree/main/Blasteroids

well this project was my first python project and I made this game at the end of my first year of college with the basic knowledge I gained from a basic intro python class in my first semester of university , now this a simple 2D game where there is a rocket and some objects and the rocket shoots those objects and if I have enough points then I can move to the next round.

now how did I make this .
first of all I got to know about a library know as pygame through my professor at university.

step by step process of how I made this game:

first of all as a beginner in coding I was intimidated by coding it self lol (crying in pain TvT)

so first I learned how to create a game loop , now as we know that our game must play until it game over , so you need to use a continuous while loop where the loop only breaks if you press the close button or exit.

now after I created a game loop I got to know about various functions in the library , like how to store pictures in variables (its know also known assets).

then Imported lot of images like space ship, meteoroids and a bomb which when hit will be game over.
then I found about a file in pygame library where I can import music and I added that.
after thats done it looked like a decent game I played and I showed it to my mom (and she was like its so dull , give it more levels and stuff)

so I made my first progress as level one

then I decided to make level to so i set a Hight score system in the game using the file I/O concept in python (which i didn't learn in my python course , got it through googling stuff like how to store permanent values in python or something lol .
so i store the value of the current score in a notepad and then retrieve it and convert it to an integer and put a comparison that if the score reaches above a highscore it will make a sound saying high score and if the point moves about a certain value that means it has leveled up and then i change its backround image and then slowly build up my game and this is my end result

so if you are a fresher like me and have some gotten some basic idea of python i recommend you to do this project.

so first before you start you need to have the pygame library so