A game engine.
Project description
# Game Engine Package - starcrusher2025
## Introduction
This package provides a simple game engine framework named starcrusher2025. It allows developers to create 2D games using Pygame by providing essential functionalities such as managing the game window, controlling player entities, handling input, and rendering.
## Installation
To install starcrusher2025-games, use pip:
```bash
pip install starcrusher2025-games
Usage
To use starcrusher2025 in your Python projects, follow the examples below:
from starcrusher2025 import Game
# Initialize the game instance
game = Game()
# Set the background color of the game window
game.window.set_bgc((0, 0, 0)) # Sets the background to black
# Set player attributes
game.player.set_color((255, 0, 0)) # Sets the player color to red
game.player.set_start_pos((400, 300)) # Sets the player starting position
game.player.set_size((50, 50)) # Sets the player size
game.player.set_speed(5) # Sets the player speed
game.player.load_image("player.png") # Loads an image for the player
# Set window size
game.window.set_size(800, 600) # Sets the game window size
# Start the game loop
game.start()
Commands
game.player.set_color(color)
Sets the color of the player entity.
- Parameters:
color
: Tuple representing the RGB color values (e.g.,(255, 0, 0)
for red).
game.player.set_start_pos(start_pos)
Sets the starting position of the player entity.
- Parameters:
start_pos
: Tuple representing the(x, y)
coordinates of the starting position.
game.player.set_size(size)
Sets the size of the player entity.
- Parameters:
size
: Tuple representing the(width, height)
of the player entity.
game.player.set_speed(speed)
Sets the speed of the player entity.
- Parameters:
speed
: Integer value representing the speed of the player.
game.player.load_image(image_path)
Loads an image file for the player entity.
- Parameters:
image_path
: Path to the image file to be loaded for the player.
game.window.set_size(width, height)
Sets the size of the game window.
- Parameters:
width
: Width of the game window in pixels.height
: Height of the game window in pixels.
game.window.set_bgc(color)
Sets the background color of the game window.
- Parameters:
color
: Tuple representing the RGB color values (e.g.,(0, 0, 0)
for black).
game.start()
Starts the game loop, which handles game logic, rendering, and input handling until the game is stopped or closed.
game.stop()
Stops the game loop and terminates the game.
Example
from starcrusher2025 import Game
# Initialize the game instance
game = Game()
# Set the background color
game.window.set_bgc((0, 0, 0)) # Sets the background to black
# Set player attributes
game.player.set_color((255, 0, 0)) # Sets the player color to red
game.player.set_start_pos((400, 300)) # Sets the player starting position
game.player.set_size((50, 50)) # Sets the player size
game.player.set_speed(5) # Sets the player speed
game.player.load_image("player.png") # Loads an image for the player
# Set window size
game.window.set_size(800, 600) # Sets the game window size
# Start the game loop
game.start()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file starcrusher2025_games-0.0.9.tar.gz
.
File metadata
- Download URL: starcrusher2025_games-0.0.9.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bc96ae9f9576b7416c03aba4e48d0c3c0dcaca605f7ae4ceb1976b0b41c7e60 |
|
MD5 | bfa76b24f30e4e7b94921b5b956b1edf |
|
BLAKE2b-256 | d79a3214b0de9fa496980bfe86bb8abc4ac7c363b6a045e0300fa71b2f77695c |
File details
Details for the file starcrusher2025_games-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: starcrusher2025_games-0.0.9-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 53bc905d67ab5f68f67dc2c82aeb48099d8732bbabea0b38a4045b96b8079717 |
|
MD5 | 06623b4db5166fbc9887d358b94b007e |
|
BLAKE2b-256 | c26c9d9b60af57cea8ecd0510fe496c07d5510b07ca07ed884115777b820134d |