Inspiration

Our inspiration for this project stemmed from our genuine passion and enthusiasm of creating something new. For us, the idea of creating a game sparked our creativity and motivated us to learn new coding languages and incorporate new libraries that we would find essential in our program. The journey of game development is a thrilling adventure that allows us to blend our imagination, problem-solving skills, and artistic expression.

What it does

Our project allows for a user to play as a battleship and shoot at enemy circles. The user may point and shoot with the mouse, aiming for as many of the enemy circles as they can. Enemy circles will also be following and targeting the user. Each time the user shoots, they are shot backwards by the recoil of the bullet, and must survive for as long as they can.

How We built it

In order to build this game, we used python and its built in pygame library. As we came up with more and more ideas for what we wanted our game to do, we did lots of research and experimenting with the pygame library and all its different functions.

Challenges We ran into

The biggest challenge that we had was learning the language and figuring out how to implement functions from the pygame library. We had originally planned to work in a language that we were already familiar with, but those languages did not have as good of a game library as python. Python is a good language for building games like ours, as well as being beginner friendly enough so that our group could learn as we did more and more research.

Accomplishments that We Are proud of

parallax.py

This module is used to create the parallax scrolling effect for the background of our game. Parallax scrolling is a technique that gives the illusion of depth in a 2D environment by moving background layers at different speeds relative to the foreground, creating a sense of perspective and depth. This module contains 3 methods. The first, init(self, layer, index)_ is our constructor which creates our parallax player and initializes it with specific properties, such as block sizes, color, and positioning. The third method, randomize(self), generates a random pattern consisting of different objects within the layer to create visual variety in the background. Finally, our last method, update(self, position) updates the position of the parallax depending on the player's position. This method is what gives us the infinite scrolling effect, and when paired with the randomize(self) method, it gives us visual representation of the blocks in the background that is being created in random locations as the player moves throughout the screen.

physics.py

Our physics module is one of the most essential modules in our code. Without the methods in this module, our game would not be able to incorporate movement, speed, acceleration, or collision. One of our methods, get_dx_dy(point1, point2) calculates the change in x and y coordinates and returns it as a point. This is essential in our program for finding out how far objects are. For example, it is used to find the distance between the enemy and player. When couples with other methods, we created a feature in the game where the player cannot simply rapid click the game window and use the recoil to escape enemies forever. Calculating the distance allows the enemy circle to quickly track the player and continue attacking. Another main method is get_collision_vectors(position1, position2, velocity1, velocity2, mass1, mass2), which simulates what happens when a collision in the game takes place and resolves it accurately and realistically.

particle.py One of the biggest aspects of this project is the creativity. We believe that code should have their own creative aspect to it, because it elevates the beauty of programs as well as making them more fun. For our creativity aspect, we included the particles.py module. A good deal of our project consists of overall polish of our effects. We included effects such as bullets, particles that come out when a bullet is shot, overall background design, and even screen shake for when a collision is detected. Our particles move and fade in the game world, simulating a real life scenario. Each particle has position, velocity, size, and color, all contributing to the creative and visually appealing aspects of our game.

What We learned

A few things we learned is that developing a game is not as easy as it seems. There are a lot of small aspects that affect the functionality of your game. A lot of small effects need to be incorporated in order to make the overall program run smoothly. Another thing we learned is how to research and implement new coding languages. We did not know how to use the pygame library, so before coding, we did hours of research to familiarize ourselves with the library and all its included functions. Finally, we learned how to work together and split tasks evenly. Each member of the group worked on a different module, and then we used our Renderer module in order to compile and run the overall game. This allowed for us to not clash, as well as work on individual aspects of the game so that if there was a bug, we could easily figure out where the bug was coming from and work together in order to fix it.

What's next for Battleship

Our plans for the future of our Battleship game is to include more visually appealing effects, and have enemies become more interactive in the game. We plan to include more color in our program, and use color to differentiate between enemies, enemy bullets, particles and sparks, and etc. We would also like to implement a scoreboard in the game so that the user can have a track of their statistics, and create various levels of difficulty. The possibilities for refining our game is endless, and we hope to continually improve and incorporate new ideas in our program.

Built With

Share this project:

Updates