Skip to main content

The Rocket game, implemented in Python

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rocket_game-26.7.1.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rocket_game-26.7.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file rocket_game-26.7.1.tar.gz.

File metadata

  • Download URL: rocket_game-26.7.1.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.34.2

File hashes

Hashes for rocket_game-26.7.1.tar.gz
Algorithm Hash digest
SHA256 7cf00de76c10bff999070ff75a1f14d5b56e49629b988d860d5dfd731765894d
MD5 bc2304c4e0afb1143e59f5b6d7ee8d3e
BLAKE2b-256 e2af10ea25eae193f1955be613b33cc76a8e226d44d52b5654b37963b3f4e862

See more details on using hashes here.

File details

Details for the file rocket_game-26.7.1-py3-none-any.whl.

File metadata

  • Download URL: rocket_game-26.7.1-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.34.2

File hashes

Hashes for rocket_game-26.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b9ae60fc17c5e57f79c8c14363373cb1b82d3c95961b9b471431a35d80fc23ec
MD5 70dd84148b11cc570f00da9bf13b6aaa
BLAKE2b-256 a643b0d2276c39edd787dfe6335babebba261518299386e5041089936bb7ad60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page