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

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.2.0
File Size Uploaded Provenance Actions
games_clz-0.2.0.tar.gz 102.1 kB Without provenance Details for games_clz-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 223.1 kB

Release files / games_clz-0.2.0.tar.gz

Download URL games_clz-0.2.0.tar.gz
Size 102.1 kB
Tags Source
SHA-256 checksum
How to use checksums
56c2bad39d7639c71eecfcdb0b5965b13b06dd1953971fc2e454cf1d21afeb4e
BLAKE2b-256 checksum
How to use checksums
6d04bc238f9f0a28e9fda85a1bfe271b944fb4d6b0e20fd00287dcbbc4887c37
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.2.0-py3-none-any.whl

Download URL games_clz-0.2.0-py3-none-any.whl
Size 121.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d486463c22ffebf35cb8788363e3acc48faf8965fe86e13dd213202fd175f959
BLAKE2b-256 checksum
How to use checksums
ff5d49a06838695a6ea326589ed2866d123e415fb561333e2b6e21b7acf52134
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.2.0

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