Skip to content

AndreiValeanu22/MiniGames_EpicMix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

© Bratu Iulian (321CA), Văleanu Andrei (321CA), Munteanu Eugen (325CA)

UNSTPB, ACS, 2023-2024

Informatică Aplicată 4 (IA4) - Python Project - Mini-Games Epic Mix

Description & Features

This project represents a collection of mini-games using Python and its appropriate libraries and functionalities. Throughout its creation we have done the following mini-games: Snake, Pong, Particles, Game of Life and ColorWheel VectorSim. Each of these will be further presented below.

Regarding its features:

  • Start menu for choosing the game to play;
  • Each mini-game has its own controls and rules;
  • Graphical user interface (GUI) implemented;
  • Retry options, game switching, score saving;
  • Mouse and keyboard controls, pixel and vector drawing and much more.

Languages and Technologies used

  • Python is the primary programming language used for this project.

  • The following libraries are mainly used: Numpy, Turtle, PyGame, Subprocess.

    Turtle library is mainly used in Snake and Pong games, while PyGame and NumPy are used in the Particles, Game of life and ColorWheel VectorSim games.


Instructions for Running/Usage

  1. Clone the repository / copy the files to your local machine.
  2. Ensure you have Python installed (recommended at least Python 3.8). Create a Virtual Environment (venv) if necessary.
  3. Install the required libraries (pip install -r requirements.txt).
  4. Run the main application depending on your Python 3 configuration (python main.py or python3 main.py) in the main folder.
  5. Use the start menu to choose and play different mini-games. You can close a game anytime by pressing the ESC key.
  6. Click the X button in the bottom-right corner of the window to close the main menu.

Each game's controls will be explained below.


Implementation

Upon opening the executable, the user will be greeted with a start menu, where they can choose between the available mini-games. After closing a game, the user will be redirected to the start menu again. Each mini-game can be anytime closed with the ESC key.

 

Snake

Control a snake on screen and eat as many apples as possible. The snake will grow longer with each apple eaten, making it harder to avoid the walls and itself. The game ends when the snake goes out-of-bounds, collides with red walls or with its body. After the game ends, the user can choose whether to retry or go back to the start menu.

At each new game, the placement of walls and apples is randomized.

NOTE: The high score is saved in a highscore.txt file, located in the same directory as the game's main.py script. Resetting the high score can be done by deleting this file.

Snake Gameplay

 

Pong

The classic arcade game! Control a paddle and try to hit the ball past the opponent's paddle. The ball will slowly get faster and harder to hit. At the beginning of each Pong game, the difficulty can be selected (easy, medium, hard). If you know Table Tennis, this should be easy... right?

The game can be stopped anytime by pressing the ESC key. By default, a match is played until one of the players reaches 5 points. After finishing, the user can choose whether to retry or go back to the start menu.

Pong Gameplay

 

Particles

Inspired by an old-school flash game made by Matteo Guarnieri (see gameplay), this simple yet fun mouse-controlled game will keep you entertained for a while. Survive as long as possible by avoiding the red particles. The game ends when the player's particle collides with a red one.

Be careful! The particles bounce off the walls as well as from each other. As time passes, the number of those will increase (the speed and initial velocity are also randomized). Fortunately, the friction will slowly decrease the speed of the particles, but not for long...

Particles Gameplay

 

Game of Life

Based on the cellular automaton model devised by mathematician John Conway, Game of life takes a step further and allows the intervention in the middle of the simulation.

The game can be paused and continued with Spacebar. With the Cursor, the player can place dead or alive cells on the screen and resume the game. Other controls are presented in the game's menu.

Game of life Gameplay

 

ColorWheel VectorSim

Using only rotating vectors, ColorWheel VectorSim game can draw any shape. A vector is defined as length, rotating speed and starting angle. The user, in a menu, can add or remove vectors and change the color and lines of the shape. While drawing, the user can pause, zoom in/out, rotate and move in a 2D environment. Pressing X will redirect the game menu where the user can add another set of vectors or load the last set.

Other controls are presented in the game's menu.

Game of life Gameplay


Team Members / Documentation

The following team members have contributed to this project:

  • Bratu Iulian (321CA)

    • Developed the start menu and linking to the game apps;
    • Game of Life and ColorWheel VectorSim developer;
    • Implemented OOP design on those applications.
  • Văleanu Andrei (321CA)

    • Game Tester for the Snake, Pong and Particles games;
    • Code debugger and reviewer for those apps.
  • Munteanu Eugen (325CA)

    • Main developer for Snake, Pong and Particles games;
    • Implemented basic OOP design for the arcade games;
    • Helper at linking between the games and the start menu;
    • Double-checked comments, code consistency and coding style (PEP8) on .py files.
  • All of us made the project's documentation and README.md file.


Encountered challenges and solutions

  1. Particles collision detection

    While developing the Particles mini-game, one of the challenging parts was the way particles were reacting at a collision. The solution was to use the NumPy library and Linear Algebra to calculate the new velocities of the particles in such an event.

    We used support from official documentation, online tutorials and Generative AI to solve this correctly.

  2. Game Menu closing and reopening

    Another challenge of the project was making the menu reappear after selecting and closing a game or more sequentially. Reviewing and understanding the documentation for the subprocess module as well as the online support made this possible.

  3. Aligning vectors

    While developing ColorWheel VectorSim, the main problem was how the lines were being drawn as vectors couldn't be aligned properly when zooming in/out and rotating the shape.

    The solution was a review of the math behind the code and, of course, trial and error.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages