# Game Engine Package - starcrusher2025
## Introduction
This package provides a versatile game engine framework named starcrusher2025. It facilitates the development of 2D games using Pygame by offering essential functionalities such as managing the game window, controlling player entities, handling input, rendering game objects, and more.
## Installation
To install starcrusher2025-games, use pip:
```bash
pip install starcrusher2025-games
```
## Usage
To use starcrusher2025 in your Python projects, follow the examples below:
```python
from starcrusher2025_games import Game #Imports the game engine
# Initialize the game instance
game = Game()
# Set the background of the game window
game.window.set_bgc(0, 0, 0) # Sets the background to black
game.window.set_bg_image("background.png") # Sets an image for the background
# 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.set_player_image("player.png") # Sets an image for the player
game.set_fps(60) # Sets the fps to 60
# Add game objects
obj1 = game.obj(start_pos=(100, 100), size=(50, 50), color=(255, 0, 0), image_path="object_image.png")
obj2 = game.obj(start_pos=(200, 200), size=(75, 75), speed=2, color=(0, 255, 0))
game.add_object(obj1)
game.add_object(obj2)
# Set window size
game.window.set_size(800, 600) # Sets the game window size
# Customize menu configuration
game.menu_config.set_bgc(30, 30, 30) # Sets the menu background color to dark gray
game.menu_config.set_bg_image("menu_background.png") # Sets an image for the menu background
# Start the game loop
game.start()
```
## Commands
### `game.window.set_bgc(r, g, b)`
Sets the background color of the game window.
- **Parameters:**
- `r`: Integer representing the red component of the RGB color (0-255).
- `g`: Integer representing the green component of the RGB color (0-255).
- `b`: Integer representing the blue component of the RGB color (0-255).
### `game.window.set_bg_image("image_path")`
Sets the background image file of the game window.
- **Parameter:**
- `image_path`: Path to the image file to be loaded for the background.
### `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.player.set_color(r, g, b)`
Sets an color for the player entity.
- **Parameters:**
- `r`: Integer representing the red component of the RGB color (0-255).
- `g`: Integer representing the green component of the RGB color (0-255).
- `b`: Integer representing the blue component of the RGB color (0-255).
### `game.player.set_player_image(image_path)`
Sets an image file for the player entity.
- **Parameters:**
- `image_path`: Path to the image file to be loaded for the player.
### `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_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_speed(speed)`
Sets the speed of the player entity.
- **Parameters:**
- `speed`: Integer value representing the speed of the player.
### `game.player.get_player_position()`
Returns the player position.
### `game.set_fps(fps)`
Sets the game's target frames per second (FPS).
- **Parameters:**
- `fps`: Integer value representing the target frames per second.
### `game.add_object(obj)`
Adds a game object to the game.
- **Parameters:**
- `obj`: Instance of `GameObject`.
- **Parameters:**
- `speed=var`
Sets the speed of the player.
- **Parameter:**
- `var`: Number for player speed.
- `image_path=var`
Sets a image file for the obj entity.
- **Parameter:**
- `var`: Path to the image file to be loaded for the player
- `start_pos=(x, y)`
Sets the start pos of the obj entity.
- **Parameters**
- `x`: Sets the `x` start position.
- `y`: Sets the `y` start position.
- `size=(x, y)`
Sets the size of the obj entity.
- **Parameters**
- `x`: Sets the `x` length.
- `y`: Sets the `y` length.
- `color=(r, g, b)`
Sets an color for the player entity.
- **Parameters:**
- `r`: Integer representing the red component of the RGB color (0-255).
- `g`: Integer representing the green component of the RGB color (0-255).
- `b`: Integer representing the blue component of the RGB color (0-255).
### `game.add_object(obj)`
Adds the obj entity in the game
- **Parameter**
- `obj`: Adds the specific obj entity
#### `game.menu_config.set_bgc(r, g, b)`
Sets the background color of the menus.
- **Parameters:**
- `r`: Integer representing the red component of the RGB color (0-255).
- `g`: Integer representing the green component of the RGB color (0-255).
- `b`: Integer representing the blue component of the RGB color (0-255).
### `game.menu_config.set_bg_image(image_path)`
Sets the path to the background image used for menus.
- **Parameters:**
- `image_path`: Path to the image file used as the background for menus.
### `game.menu_config.set_title(var)`
Sets the titel in the main menu
- **Parameters:**
- `var`: Sets the Name that will be displayed
### `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.
## License
This project is licensed under the MIT License. See the LICENSE.md file for details.
Raw data
{
"_id": null,
"home_page": "https://github.com/starcrusher2025/2025_games",
"name": "starcrusher2025-games",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "starcrusher2025",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/fb/3f/9409e624f7a1da0d44aabe21d467004a7f654b4b7100b6a8c8d578c1ee6d/starcrusher2025_games-1.2.1.tar.gz",
"platform": null,
"description": "# Game Engine Package - starcrusher2025\r\n\r\n## Introduction\r\nThis package provides a versatile game engine framework named starcrusher2025. It facilitates the development of 2D games using Pygame by offering essential functionalities such as managing the game window, controlling player entities, handling input, rendering game objects, and more.\r\n\r\n## Installation\r\nTo install starcrusher2025-games, use pip:\r\n\r\n```bash\r\npip install starcrusher2025-games\r\n```\r\n\r\n## Usage\r\nTo use starcrusher2025 in your Python projects, follow the examples below:\r\n\r\n```python\r\nfrom starcrusher2025_games import Game #Imports the game engine\r\n\r\n# Initialize the game instance\r\ngame = Game()\r\n\r\n# Set the background of the game window\r\ngame.window.set_bgc(0, 0, 0) # Sets the background to black\r\ngame.window.set_bg_image(\"background.png\") # Sets an image for the background\r\n\r\n# Set player attributes\r\ngame.player.set_color(255, 0, 0) # Sets the player color to red\r\ngame.player.set_start_pos(400, 300) # Sets the player starting position\r\ngame.player.set_size(50, 50) # Sets the player size\r\ngame.player.set_speed(5) # Sets the player speed\r\ngame.player.set_player_image(\"player.png\") # Sets an image for the player\r\ngame.set_fps(60) # Sets the fps to 60\r\n\r\n# Add game objects\r\nobj1 = game.obj(start_pos=(100, 100), size=(50, 50), color=(255, 0, 0), image_path=\"object_image.png\")\r\nobj2 = game.obj(start_pos=(200, 200), size=(75, 75), speed=2, color=(0, 255, 0))\r\n\r\ngame.add_object(obj1)\r\ngame.add_object(obj2)\r\n\r\n# Set window size\r\ngame.window.set_size(800, 600) # Sets the game window size\r\n\r\n# Customize menu configuration\r\ngame.menu_config.set_bgc(30, 30, 30) # Sets the menu background color to dark gray\r\ngame.menu_config.set_bg_image(\"menu_background.png\") # Sets an image for the menu background\r\n\r\n# Start the game loop\r\ngame.start()\r\n```\r\n\r\n## Commands\r\n\r\n### `game.window.set_bgc(r, g, b)`\r\nSets the background color of the game window.\r\n\r\n- **Parameters:**\r\n - `r`: Integer representing the red component of the RGB color (0-255).\r\n - `g`: Integer representing the green component of the RGB color (0-255).\r\n - `b`: Integer representing the blue component of the RGB color (0-255).\r\n\r\n### `game.window.set_bg_image(\"image_path\")`\r\nSets the background image file of the game window.\r\n\r\n- **Parameter:**\r\n - `image_path`: Path to the image file to be loaded for the background.\r\n\r\n### `game.window.set_size(width, height)`\r\nSets the size of the game window.\r\n\r\n- **Parameters:**\r\n - `width`: Width of the game window in pixels.\r\n - `height`: Height of the game window in pixels.\r\n\r\n### `game.player.set_color(r, g, b)`\r\nSets an color for the player entity.\r\n\r\n- **Parameters:**\r\n - `r`: Integer representing the red component of the RGB color (0-255).\r\n - `g`: Integer representing the green component of the RGB color (0-255).\r\n - `b`: Integer representing the blue component of the RGB color (0-255).\r\n\r\n### `game.player.set_player_image(image_path)`\r\nSets an image file for the player entity.\r\n\r\n- **Parameters:**\r\n - `image_path`: Path to the image file to be loaded for the player.\r\n\r\n### `game.player.set_size(size)`\r\nSets the size of the player entity.\r\n\r\n- **Parameters:**\r\n - `size`: Tuple representing the `(width, height)` of the player entity.\r\n\r\n### `game.player.set_start_pos(start_pos)`\r\nSets the starting position of the player entity.\r\n\r\n- **Parameters:**\r\n - `start_pos`: Tuple representing the `(x, y)` coordinates of the starting position.\r\n\r\n### `game.player.set_speed(speed)`\r\nSets the speed of the player entity.\r\n\r\n- **Parameters:**\r\n - `speed`: Integer value representing the speed of the player.\r\n\r\n### `game.player.get_player_position()`\r\nReturns the player position.\r\n\r\n### `game.set_fps(fps)`\r\nSets the game's target frames per second (FPS).\r\n\r\n- **Parameters:**\r\n - `fps`: Integer value representing the target frames per second.\r\n\r\n### `game.add_object(obj)`\r\nAdds a game object to the game.\r\n\r\n- **Parameters:**\r\n - `obj`: Instance of `GameObject`.\r\n\r\n - **Parameters:**\r\n - `speed=var`\r\n Sets the speed of the player. \r\n\r\n - **Parameter:**\r\n - `var`: Number for player speed.\r\n\r\n - `image_path=var`\r\n Sets a image file for the obj entity. \r\n \r\n - **Parameter:**\r\n - `var`: Path to the image file to be loaded for the player\r\n\r\n - `start_pos=(x, y)`\r\n Sets the start pos of the obj entity.\r\n\r\n - **Parameters**\r\n - `x`: Sets the `x` start position.\r\n - `y`: Sets the `y` start position.\r\n \r\n - `size=(x, y)`\r\n Sets the size of the obj entity.\r\n\r\n - **Parameters**\r\n - `x`: Sets the `x` length.\r\n - `y`: Sets the `y` length.\r\n \r\n - `color=(r, g, b)`\r\n Sets an color for the player entity.\r\n\r\n - **Parameters:**\r\n - `r`: Integer representing the red component of the RGB color (0-255).\r\n - `g`: Integer representing the green component of the RGB color (0-255).\r\n - `b`: Integer representing the blue component of the RGB color (0-255).\r\n\r\n### `game.add_object(obj)`\r\nAdds the obj entity in the game\r\n\r\n- **Parameter**\r\n - `obj`: Adds the specific obj entity\r\n\r\n#### `game.menu_config.set_bgc(r, g, b)`\r\nSets the background color of the menus.\r\n\r\n- **Parameters:**\r\n - `r`: Integer representing the red component of the RGB color (0-255).\r\n - `g`: Integer representing the green component of the RGB color (0-255).\r\n - `b`: Integer representing the blue component of the RGB color (0-255).\r\n\r\n### `game.menu_config.set_bg_image(image_path)`\r\nSets the path to the background image used for menus.\r\n\r\n- **Parameters:**\r\n - `image_path`: Path to the image file used as the background for menus.\r\n\r\n### `game.menu_config.set_title(var)`\r\nSets the titel in the main menu\r\n\r\n- **Parameters:**\r\n - `var`: Sets the Name that will be displayed\r\n\r\n### `game.start()`\r\nStarts the game loop, which handles game logic, rendering, and input handling until the game is stopped or closed.\r\n\r\n### `game.stop()`\r\nStops the game loop and terminates the game.\r\n\r\n## License\r\nThis project is licensed under the MIT License. See the LICENSE.md file for details.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A easy to use game engine.",
"version": "1.2.1",
"project_urls": {
"Homepage": "https://github.com/starcrusher2025/2025_games"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fb3f9409e624f7a1da0d44aabe21d467004a7f654b4b7100b6a8c8d578c1ee6d",
"md5": "cb2cbac8a51a87993a31f77c1228165e",
"sha256": "e0fef108ef40ad3a6cfe734fa26df3b1b9930724b076827ee27860a3afcb5286"
},
"downloads": -1,
"filename": "starcrusher2025_games-1.2.1.tar.gz",
"has_sig": false,
"md5_digest": "cb2cbac8a51a87993a31f77c1228165e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10371,
"upload_time": "2024-09-06T11:53:47",
"upload_time_iso_8601": "2024-09-06T11:53:47.595105Z",
"url": "https://files.pythonhosted.org/packages/fb/3f/9409e624f7a1da0d44aabe21d467004a7f654b4b7100b6a8c8d578c1ee6d/starcrusher2025_games-1.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-06 11:53:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "starcrusher2025",
"github_project": "2025_games",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "starcrusher2025-games"
}