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.2

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.2
File Size Uploaded Provenance Actions
games_clz-0.1.2.tar.gz 99.3 kB Without provenance Details for games_clz-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 216.0 kB

Release files / games_clz-0.1.2.tar.gz

Download URL games_clz-0.1.2.tar.gz
Size 99.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4eb0e6d5aed04654109eefcb721fc5c8dd7dc21b63a7b59c70c42c738e68ac39
BLAKE2b-256 checksum
How to use checksums
5cce927c8fd708c9c50c0fd4d21b36759d5c8c7c3f3fb8755a53ce14485c9b77
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.2-py3-none-any.whl

Download URL games_clz-0.1.2-py3-none-any.whl
Size 116.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f3f67f08b7ee517beb473c322494f472f71cfde4d0d7b3b2c3947e0fa30cd00d
BLAKE2b-256 checksum
How to use checksums
1fcd2bbce3deb1a9a7b48568a55359a647a32758b572555af52fdf8fff9d4176
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.2

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