https://github.com/klihe/asteroids-pygame
A simple game of shooting asteroids with a rocket and getting a points
https://github.com/klihe/asteroids-pygame
asteroids game pygame python rocket
Last synced: 5 months ago
JSON representation
A simple game of shooting asteroids with a rocket and getting a points
- Host: GitHub
- URL: https://github.com/klihe/asteroids-pygame
- Owner: Klihe
- Created: 2024-01-05T13:53:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-22T13:51:22.000Z (almost 2 years ago)
- Last Synced: 2025-02-15T20:49:06.796Z (over 1 year ago)
- Topics: asteroids, game, pygame, python, rocket
- Language: Python
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Asteroids-PyGame
A simple game of shooting asteroids with a rocket and getting a points
## Requirements
- [pygame](https://www.pygame.org/wiki/GettingStarted)
## Run
### MacOS/Linux
```bash
python3 main.py
```
### Windows
```bash
python main.py
```
## Controls
ESC - escape game
w - up
d - down
a - right
s - left
space - fire
r - reload
## States of game
- MENU - until you click on start button
- PLAYING - until you die
- GAME OVER - show best local score
## Objects
### Player
```python
self.angle = 0
self.score = 0
# hit asteroids with your body
self.body_damage = 15
self.health = 100
self.rotation_speed_current = 0
self.movement_speed_current = 2.5
self.movement_speed_max = 10
```
### Projectile
```python
# get angle from rocket
self.angle = angle
self.movement_speed = 25 + speed
self.damage = 15
```
### Asteroids
```python
if self.size == "small":
self.health = 15
self.damage = 10
self.score = 5
elif self.size == "medium":
self.health = 30
self.damage = 15
self.score = 10
elif self.size == "large":
self.health = 45
self.damage = 20
self.score = 15
```