Skip to main content

A simple game logic library with inventory, items, and cooldown system

Project description

Python PyPI License

pygamelogic

A lightweight Python game logic library featuring inventory systems, item mechanics, and cooldown management — designed for simplicity and extensibility.


🚀 Installation

pip install pygamelogic

✨ Features

  • 📦 Inventory system with capacity limits
  • 🧪 Stackable items (e.g., potions)
  • ⚔️ Item subclasses (Potion, Weapon, Armor)
  • ⏳ Cooldown system to prevent repeated usage
  • ❤️ Health system (damage & healing mechanics)
  • 🔍 Search, filter, and sorting utilities

🧪 Quick Example

from pygamelogic import InventorySystem, Potion, HealthSystem

# Create player with 100 HP
player = HealthSystem(100)

# Create inventory
inventory = InventorySystem(5)

# Create potion
potion = Potion("Potion", "common", 5, heal_amount=20, quantity=2, cooldown=3)

# Add potion to inventory
inventory.add_item(potion)

print("Before:", player.current_health)

# Use potion
inventory.use_item(potion, player)

print("After:", player.current_health)

📊 Example Output

Before: 100
Potion used! Healed 20 HP.
After: 100

⚙️ Core Systems

📦 Inventory System

  • Add and remove items
  • Capacity management
  • Stackable item support
  • Sorting and filtering

🧩 Item System

  • Base class: Item

  • Subclasses:

    • Potion → heals target
    • Weapon → deals damage
    • Armor → increases defense
  • Rarity-based value scaling

⏳ Cooldown System

  • Prevents item spamming
  • Tracks cooldown per item
  • Provides remaining cooldown time

🧠 Cooldown Example

inventory.use_item(potion, player)
inventory.use_item(potion, player)  # ❌ Raises cooldown error

📁 Project Structure

pygamelogic/
│
├── inventory.py
├── item.py
├── cooldown.py
├── health.py

🎯 Use Cases

  • Beginner-friendly game development
  • Prototyping RPG mechanics
  • Learning object-oriented design
  • Building inventory-based systems

👨‍💻 Author

Muhilvannan Elavazhagan


🌐 Links


📜 License

This project is licensed under the MIT License.

Copyright (c) 2026 Muhilvannan

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

pygamelogic-0.1.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

pygamelogic-0.1.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file pygamelogic-0.1.1.tar.gz.

File metadata

  • Download URL: pygamelogic-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pygamelogic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f7bb9437d2db862a7ccd34f4fc7d7996496b3f5245880c84e44753c5eaac8aef
MD5 d1356be7d42be775da0e2213789c3d8d
BLAKE2b-256 3596300fe3108da1ff4ec451f30ae2f5d1a5703b40216c54f8a6e844c2e63b54

See more details on using hashes here.

File details

Details for the file pygamelogic-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pygamelogic-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for pygamelogic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89525cecaae85664233efd812568909d7a9be55a98985a6003552d554abcf99d
MD5 09c6456c1190e569fc35e9a3d3f6f031
BLAKE2b-256 973fa8f4edda7661b90d6bf3b2cca6c036177d1baf21a3695b4983970132b381

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