Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erthium/spaceinvaders
Good old Space Invaders game made in Python with Pygame.
https://github.com/erthium/spaceinvaders
2d-game game oop pygame python space-invaders
Last synced: about 1 month ago
JSON representation
Good old Space Invaders game made in Python with Pygame.
- Host: GitHub
- URL: https://github.com/erthium/spaceinvaders
- Owner: erthium
- License: mit
- Created: 2020-02-10T15:28:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-22T21:41:52.000Z (about 1 year ago)
- Last Synced: 2024-06-04T00:00:03.980Z (7 months ago)
- Topics: 2d-game, game, oop, pygame, python, space-invaders
- Language: Python
- Homepage:
- Size: 397 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Space Invaders
A prototype version of the old arcade game Space Invaders from 1980s, made with Python's Pygame.
## License
This project is [MIT](https://github.com/ErtyumPX/SpaceInvaders/blob/main/LICENSE) licensed.
## Setup
The python script 'main.py' is the launcher of the game. After you clone or download the repository, you can run that file.
Beware that used Python version of this project is [3.8.3](https://www.python.org/downloads/release/python-383) and the used Pygame version is [2.0.1](https://www.pygame.org/project/5409/7928).
## Mechanics & Algorithms
### Enemy Fleet Movement
Invaders always act coordinated with their fleet. Every time they loose a fellow ship, they get faster. When they reach the end of a side, they flip the movement to the other side.
### Enemy Attack
The game starts with an 8x6 fleet. Only the ships on the front lines are allowed to attack, with a reasonable cooldown. Every time an invader in the front line is eliminated, the one on the back takes over.
Plus, invaders does not shoot randomly but only if the user 'protector' are on their sight. If there is nobody in sight for some time, they start shooting randomly to limit user's movement.
### User Interface Elements
Pygame's itself does not support enhanced UI elements. All the elemenets and widgets used in this game are from [PyGameEngine](https://github.com/ErtyumPX/PyGameEngine).
## Inefficiencies
A one-dimensional array was used to hold the invaders. This causes many lines of code while determining which invader is on the front line and which can attack. Yet this was more efficient for the movement calculations.
There is a glitch with the sound effects at some certain scenerious; yet not easily reproducable. Does not cause much problem yet it was hard to fix because the sound system in Pygame is not the best.