Skip to main content

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

Metadata

Release files for pygamelogic 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygamelogic 0.1.1
File Size Uploaded
pygamelogic-0.1.1.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pygamelogic 0.1.1
File Interpreter ABI Platform
pygamelogic-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / pygamelogic-0.1.1.tar.gz

Download URL pygamelogic-0.1.1.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f7bb9437d2db862a7ccd34f4fc7d7996496b3f5245880c84e44753c5eaac8aef
BLAKE2b-256 checksum
How to use checksums
3596300fe3108da1ff4ec451f30ae2f5d1a5703b40216c54f8a6e844c2e63b54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release files / pygamelogic-0.1.1-py3-none-any.whl

Download URL pygamelogic-0.1.1-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89525cecaae85664233efd812568909d7a9be55a98985a6003552d554abcf99d
BLAKE2b-256 checksum
How to use checksums
973fa8f4edda7661b90d6bf3b2cca6c036177d1baf21a3695b4983970132b381
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page