Skip to main content

Games_clz

一个简单好用的Python游戏引擎包,内含完整的三维游戏引擎和二维游戏引擎,API风格统一简洁,不用记复杂的函数。

安装:

pip install Games_clz

快速开始

写3D游戏

from games_clz import *

# 初始化3D模式
init(mode='3d', title="我的第一个3D游戏")

# 地面
ground = Entity(model='plane', texture='grass', scale=50, collider='box')
# 第一人称玩家
player = FirstPerson(position=(0, 2, 0))
# 血条和小地图
Health(player, max_hp=100)
HealthBar(get_health(player), anchor="top-left")
Minimap(follow=player, anchor="top-right")
# 天空盒
Sky()

run()

操作:WASD移动,空格跳跃,鼠标转视角,Esc退出。

写2D游戏

from games_clz import *

# 初始化2D模式
init(mode='2d', title="我的第一个2D游戏")

# 地面和玩家
ground = Sprite2D(color=color.green, y=-3.5, scale=(20, 1), collider='box', static=True)
player = Sprite2D(color=color.blue, x=0, y=0, scale=(0.8, 1.2), collider='box', rigidbody=True)

def update():
    # A/D移动,空格跳跃
    player.velocity.x = 0
    if held_keys['a']: player.velocity.x = -6
    if held_keys['d']: player.velocity.x = 6
    if held_keys['space'] and player.grounded:
        player.velocity.y = 12
    camera.follow(player)

run()

包含功能

3D引擎(three_dimensional_games)

  • ✅ 基础实体、场景、相机系统
  • ✅ 三种视角控制器:第一人称/第二人称/第三人称
  • ✅ 物理系统:碰撞检测、刚体、射线检测
  • ✅ 内置大量免费贴图(草地、砖块、天空等)
  • ✅ 补间动画系统
  • ✅ 粒子特效系统
  • ✅ 音效、背景音乐播放
  • ✅ 触发区/碰撞事件
  • ✅ 存档/读档
  • ✅ 生命值、伤害系统、屏幕血条、世界血条
  • ✅ 小地图/雷达
  • ✅ AI导航网格、自动寻路敌人
  • ✅ 联机功能:公网/局域网开房联机
  • ✅ 高级射线检测、调试画线
  • ✅ 手柄支持
  • ✅ 语音:TTS播报、录音、语音识别、语音聊天
  • ✅ 天空盒

2D引擎(two_dimensional_games)

  • ✅ 精灵系统(支持贴图/纯色)
  • ✅ 帧动画精灵
  • ✅ AABB物理碰撞、刚体重力、落地检测
  • ✅ 正交相机、平滑跟随
  • ✅ 文字、按钮UI
  • ✅ 粒子特效、爆炸效果
  • ✅ 补间动画
  • ✅ 鼠标、键盘输入
  • ✅ 模块级钩子(def update() / def input())
  • ✅ 自动兜底运行(不写run()也能跑)

示例

解压后examples目录下有完整示例:

  • examples/3d_demo.py:3D第一人称打敌人类小游戏
  • examples/2d_platformer.py:2D平台跳跃吃金币小游戏

发布到PyPI

如果你自己修改后要发布:

# 打包
python -m build
# 上传(用你的PyPI Token)
python -m twine upload -u __token__ -p 你的Token dist/*

Metadata

Release files for Games-clz 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 Games-clz 0.1.1
File Size Uploaded Provenance Actions
games_clz-0.1.1.tar.gz 99.4 kB Without provenance Details for games_clz-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 216.1 kB

Release files / games_clz-0.1.1.tar.gz

Download URL games_clz-0.1.1.tar.gz
Size 99.4 kB
Tags Source
SHA-256 checksum
How to use checksums
24940ffac99dec0ef1a14c580949c919d88c105a1eba4d2b7a1d9108aa157b36
BLAKE2b-256 checksum
How to use checksums
18ad2e1420473600e388bff772185057b0c388500412ddc5b2a00aa9846e7020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

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

Download URL games_clz-0.1.1-py3-none-any.whl
Size 116.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e01d5a191879a159cd42ec2cf5153e4480330afbd1b040964a7d1f1f26f7bd23
BLAKE2b-256 checksum
How to use checksums
033deef3123217ae636ec9e879f4e35f73d41dfd9a10a9371cbb03df72b1bc9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for Games-clz 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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