Giter VIP home page Giter VIP logo

watersorting's Introduction

WaterSorting 水排序

A simple 'WaterSorting' game made by Pygame
简单的水排序 Pygame 小游戏

How to run 使用方法

Run the ‘example.py’ directly
直接运行 'example.py'

How to play 玩法

一栏(竖列)色块是一支试管,色块是水
点击一栏色块再点击另一栏色块,试管里的水就会移动
如果点击错误,只要再次点击误点到的试管即可
卡关按 'R' 键重玩
保存随机关卡按 'CTRL' + 'S'

A column of color block is a test tube, and the color block is water.
Click one column of color blocks and then click another column of color blocks, and the water in the test tube will move.
If the clicked test tube is unexcepted, just click the test tube again.
Press the 'R' key to play again.
Save the random level by pressing 'CTRL'+'S'

Guides 向导

At first, the WaterSorting package has been in the downloaded source code folder.
首先,WaterSorting Python 包已经在下载的源代码文件夹中

Actually, we created the 'example.py' in the same level folder of WaterSorting package.
其实我们在 WaterSorting Python 包的同级文件夹中创建了 'example.py'

Import the WaterSorting python package if you want to make a custom program.
如果你想自定义程序,那么就导入 WaterSorting Python 包吧!

import WaterSorting

About how to write the code to make custom one, we will talk about it later.
关于如何编写代码,我们将在后面讨论

Let's check the 'example.py' first.
我们先来看看 ’example.py‘

import WaterSorting

WaterSorting.pge.playWithPyGame()
WaterSorting.pge.playWithPyGame(16)

The pge means 'Pygame Edition', so WaterSorting can complete the whole game process with only the terminal or any other module.
pge 意思是 'Pygame 版',所以实际上 WaterSorting 可以只用终端或其它模块完成整个游戏过程

playWithPygame(16) means a random level with difficulty level 16.
playWithPygame(16) 意思是 16 级难度的随机关卡

If you run playWithPygame() with no arguments, the game will start with program own levels.
如果在没有参数的情况下运行playWithPygame(),游戏将以程序自己的关卡开始

Folder Tree:
文件夹树:

WaterSorting
│  core.py
│  levels.py
│  pge.py
│  __init__.py
└─

core.py:

The core program of the game has a class library that supports games and sandboxes.
游戏的核心程序,有支持游戏与沙盒的类库

levels.py:

For managing levels.
管理关卡的程序

pge.py:

Pygame-supported programs inherit the core.py class.
支持 Pygame 的程序,继承了 core.py 的类

__init__.py:

Initialization program.
初始化程序

Classes & Function 类与函数

class core|pge.Level(Object | core.Level) (l, limit)

param { l: list }
The level data
关卡数据
param { limit: int }
level difficulty/height limit
关卡难度/限高

class core|pge.Levels(Level | core.Level) (levs)

param { levs: list [...Level.l] }
The list is full of level data
关卡数据列表

class core|pge.Generator(Level | core.Level, core.Generator) (number, limit)

param { number: int }
The number of test tube
试管数
param { limit: int }
level difficulty/height limit
关卡难度/限高

function core.playWithConsole(limit)

param { limit: int } (Optional)
level difficulty/height limit
关卡难度/限高
If you run playWithConsole() with no arguments, the game will start with program own levels.
如果在没有参数的情况下运行 playWithConsole(),游戏将以程序自己的关卡开始

function pge.playWithPygame(limit)

param { limit: int } (Optional)
level difficulty/height limit
关卡难度/限高
If you run playWithPygame() with no arguments, the game will start with program own levels.
如果在没有参数的情况下运行 playWithPygame(),游戏将以程序自己的关卡开始

Method & Attribute 方法与属性

Simple code, no need

watersorting's People

Contributors

plswrxtq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.