rocket_game
The Rocket game, implemented in Python, inspired by https://github.com/aochagavia/rocket_wasm.
This implements the game logic, but the drawing/rendering is left as an excercise for the reader.
Usage
from rocket_game import RocketGame
game = RocketGame()
# Properties
game.ship # the ship's position (x, y)
game.ship_angle # the ship's angle in radians
game.enemies # the enemy positions (Nx2 array)
game.bullets # the bullet positions
game.particles # the particle positions (Nx3 array, 3d column are the weights)
game.score # the current score
# Methods
# Set the world size, either once or when window resizes (safe to call at each draw)
game.set_world_size(width: float, height: float, scale=1)
# Reset the game (called automatically when dying)
game.reset()
# Let the game progress
game.auto_tick() # recommended
game.tick(time_delta: float) # more control
# Control the ship
game.toggle_boost(boosting: bool)
game.toggle_shoot(shooting: bool)
game.toggle_turn_left(turning_left: bool)
game.toggle_turn_right(turning_right: bool)
game.toggle_all_off()
Example screenshots
Release files for rocket_game 26.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rocket_game-26.7.1.tar.gz | 2.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rocket_game-26.7.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.1 MB
Release files / rocket_game-26.7.1.tar.gz
| Download URL | rocket_game-26.7.1.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7cf00de76c10bff999070ff75a1f14d5b56e49629b988d860d5dfd731765894d
|
|
BLAKE2b-256 checksum How to use checksums |
e2af10ea25eae193f1955be613b33cc76a8e226d44d52b5654b37963b3f4e862
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.34.2
|
Release files / rocket_game-26.7.1-py3-none-any.whl
| Download URL | rocket_game-26.7.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9ae60fc17c5e57f79c8c14363373cb1b82d3c95961b9b471431a35d80fc23ec
|
|
BLAKE2b-256 checksum How to use checksums |
a643b0d2276c39edd787dfe6335babebba261518299386e5041089936bb7ad60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.34.2
|