Skip to content

Commit

Permalink
update readme en
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun committed Apr 8, 2018
1 parent b36e0f3 commit d1a4845
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 166 deletions.
88 changes: 48 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,114 +1,122 @@
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

<h1 align="center">盖楼游戏</h1>
English | [简体中文](./README.zh-CN.md)

<h1 align="center">Tower Building Game</h1>
<p align="center"><img src="https://o2qq673j2.qnssl.com/tower-loading.gif"/></p>

> 一个基于 Canvas 的盖楼游戏
> a tower building game based on Canvas
> Tower Building Game (Tower Bloxx Deluxe Skyscraper)
## Demo 预览
## Demo
<p align="center"><img src="http://obdhoyfg4.bkt.clouddn.com/tower-preview.gif"/></p>
<h2 align="center"><a href="http://fe.bmqb.com/tower_game/demo.html?v=1">在线预览地址 (Demo Link)</a></h2>
<h4 align="center">手机设备可以扫描下方二维码</h4>
<h2 align="center"><a href="http://fe.bmqb.com/tower_game/demo.html?v=1">Link to online Demo (Demo Link)</a></h2>
<h4 align="center">Mobile Devices can scan following QR code:</h4>
<p align="center">
<img src="https://o2qq673j2.qnssl.com/tower-game-qr-code.png" />
</p>

## Game Rule 游戏规则
## Game Rule

The following are the default game rule:

以下为默认游戏规则,也可参照下节自定义游戏参数
- In every game player starts with 3 hp. Every time a Tower block is dropped player is deduct 1 hp; game ends when hp is depleted.

- 每局游戏生命值为3,掉落一块楼层生命值减1,掉落3块后游戏结束,单局游戏无时间限制
- Player is rewarded with 25 point for every succesful stacked blocks(Success). If a block is stacked pefectly (Perfect) on top of the previous one, then player
rewarded with 50 points instead. Consecutive Perfects awards additional 25 points.

- 成功盖楼加25分,完美盖楼加50分,连续完美盖楼额外加25分,楼层掉落扣除生命值1,单局游戏共有3次掉落机会
**Note: Each Success or Perfect constitutes a floor**

栗子:第一块完美盖楼加50分,第二块连续完美盖楼加75分,第三块连续完美盖楼加100分,依此类推……
For example, the first Perfect awards 50 point. The second consecutive Perfect awards 75 points.
The third consecutive Perfect awards 100 points. etc.

<p align="center">
<img src="https://o2qq673j2.qnssl.com/Fv7ewqHHXeAnUAlF7AI9ndQulEOC" />
</p>

## Customise 自定义
## Customizing the game rule

```
git clone https://github.com/bmqb/tower_game.git
cd tower_game
npm install
npm start
```
打开 `http://localhost:8082`
Open `http://localhost:8082` in a web browser.

- To customize image and sound resource files directly replace the corresponding file under `assets` directory.
- To customize game rules modify the `option` object in `index.html`.

- 图片、音频资源可以直接替换 `assets` 目录下对应的资源文件
- 游戏规则可以修改 `index.html` 文件 `L480``option` 对象
## Option

## Option 自定义选项
Use following table of `option` constants to complete customization of game rules.

可以使用以下 `option` 表格里的参数,完成游戏自定义,**所有参数都是非必填项**
**Note: all constants are optionally included**

| Option | Type | Description |
|---------|--------|-------------|
| width | number | 游戏主画面宽度 |
| height | number | 游戏主画面高度 |
| canvasId | string | Canvas 的 DOM ID |
| soundOn | boolean | 是否开启声音 |
| successScore | number | 成功盖楼分数 |
| perfectScore | number | 完美盖楼额外奖励分数 |
| <a href="#hookspeed">hookSpeed</a> | function | 钩子平移速度 |
| <a href="#hookangle">hookAngle</a> | function | 钩子摆动角度 |
| <a href="#landblockspeed">landBlockSpeed</a> | function | 下方楼房横向速度 |
| <a href="#setgamescore">setGameScore</a> | function | 当前游戏分数hook |
| <a href="#setgamesuccess">setGameSuccess</a> | function | 当前游戏成功次数hook |
| <a href="#setgamefailed">setGameFailed</a> | function | 当前游戏失败次数hook |
| width | number | Width of game interface |
| height | number | Height of game interface |
| canvasId | string | DOM ID in Canvas |
| soundOn | boolean | If sound is on |
| successScore | number | Points awarded for success |
| perfectScore | number | Additional points awarded for perfect |
| <a href="#hookspeed">hookSpeed</a> | function | Speed of hook's movement |
| <a href="#hookangle">hookAngle</a> | function | Angle of hook |
| <a href="#landblockspeed">landBlockSpeed</a> | function | Speed of block sway |
| <a href="#setgamescore">setGameScore</a> | function | hook for current score |
| <a href="#setgamesuccess">setGameSuccess</a> | function | hook for number of current succesful game |
| <a href="#setgamefailed">setGameFailed</a> | function | hook for number of current failed game |

#### hookSpeed
钩子平移速度
函数接收两个参数,当前成功楼层和当前分数,返回速度数值
Speed of hook's movement
This function takes in two parameters, currentFloor and currentScore, and returns a speed value.
```
function(currentFloor, currentScore) {
return number
}
```

#### hookAngle
钩子摆动角度
函数接收两个参数,当前成功楼层和当前分数,返回角度数值
Angle of hook
This function takes in two parameters, currentFloor and currentScore, and returns a angle value.
```
function(currentFloor, currentScore) {
return number
}
```

#### landBlockSpeed
下方楼房平移速度
函数接收两个参数,当前成功楼层和当前分数,返回速度数值
Speed of block sway
This function takes in two parameters, currentFloor and currentScore, and returns a speed value.
```
function(currentFloor, currentScore) {
return number
}
```

#### setGameScore
当前游戏分数hook
函数接收一个参数,当前游戏分数
hook for current score
This function takes in one parameters, score, and sets currentScore to score.
```
function(score) {
// your logic
}
```

#### setGameSuccess
当前游戏成功次数hook
函数接收一个参数,当前游戏成功次数
hook for number of current succesful game
This function takes in one parameters, score, and sets GameSuccess to successCount.
```
function(successCount) {
// your logic
}
```

#### setGameFailed
当前游戏失败次数hook
函数接收一个参数,当前游戏失败次数
hook for number of current failed game
This function takes in one parameters, score, and sets GameFailed to failedCount.
```
function(failedCount) {
// your logic
Expand Down
128 changes: 128 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
[![LICENSE](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

[English](./README.md) | 简体中文

<h1 align="center">盖楼游戏</h1>
<p align="center"><img src="https://o2qq673j2.qnssl.com/tower-loading.gif"/></p>

> 一个基于 Canvas 的盖楼游戏
> Tower Building Game (Tower Bloxx Deluxe Skyscraper)
## Demo 预览
<p align="center"><img src="http://obdhoyfg4.bkt.clouddn.com/tower-preview.gif"/></p>
<h2 align="center"><a href="http://fe.bmqb.com/tower_game/demo.html?v=1">在线预览地址 (Demo Link)</a></h2>
<h4 align="center">手机设备可以扫描下方二维码</h4>
<p align="center">
<img src="https://o2qq673j2.qnssl.com/tower-game-qr-code.png" />
</p>

## Game Rule 游戏规则

以下为默认游戏规则,也可参照下节自定义游戏参数

- 每局游戏生命值为3,掉落一块楼层生命值减1,掉落3块后游戏结束,单局游戏无时间限制

- 成功盖楼加25分,完美盖楼加50分,连续完美盖楼额外加25分,楼层掉落扣除生命值1,单局游戏共有3次掉落机会

栗子:第一块完美盖楼加50分,第二块连续完美盖楼加75分,第三块连续完美盖楼加100分,依此类推……

<p align="center">
<img src="https://o2qq673j2.qnssl.com/Fv7ewqHHXeAnUAlF7AI9ndQulEOC" />
</p>

## Customise 自定义

```
git clone https://github.com/bmqb/tower_game.git
cd tower_game
npm install
npm start
```
打开 `http://localhost:8082`

- 图片、音频资源可以直接替换 `assets` 目录下对应的资源文件
- 游戏规则可以修改 `index.html` 文件 `L480``option` 对象

## Option 自定义选项

可以使用以下 `option` 表格里的参数,完成游戏自定义,**所有参数都是非必填项**

| Option | Type | Description |
|---------|--------|-------------|
| width | number | 游戏主画面宽度 |
| height | number | 游戏主画面高度 |
| canvasId | string | Canvas 的 DOM ID |
| soundOn | boolean | 是否开启声音 |
| successScore | number | 成功盖楼分数 |
| perfectScore | number | 完美盖楼额外奖励分数 |
| <a href="#hookspeed">hookSpeed</a> | function | 钩子平移速度 |
| <a href="#hookangle">hookAngle</a> | function | 钩子摆动角度 |
| <a href="#landblockspeed">landBlockSpeed</a> | function | 下方楼房横向速度 |
| <a href="#setgamescore">setGameScore</a> | function | 当前游戏分数hook |
| <a href="#setgamesuccess">setGameSuccess</a> | function | 当前游戏成功次数hook |
| <a href="#setgamefailed">setGameFailed</a> | function | 当前游戏失败次数hook |

#### hookSpeed
钩子平移速度
函数接收两个参数,当前成功楼层和当前分数,返回速度数值
```
function(currentFloor, currentScore) {
return number
}
```

#### hookAngle
钩子摆动角度
函数接收两个参数,当前成功楼层和当前分数,返回角度数值
```
function(currentFloor, currentScore) {
return number
}
```

#### landBlockSpeed
下方楼房平移速度
函数接收两个参数,当前成功楼层和当前分数,返回速度数值
```
function(currentFloor, currentScore) {
return number
}
```

#### setGameScore
当前游戏分数hook
函数接收一个参数,当前游戏分数
```
function(score) {
// your logic
}
```

#### setGameSuccess
当前游戏成功次数hook
函数接收一个参数,当前游戏成功次数
```
function(successCount) {
// your logic
}
```

#### setGameFailed
当前游戏失败次数hook
函数接收一个参数,当前游戏失败次数
```
function(failedCount) {
// your logic
}
```

## Join us

<img src="https://ofw30mjf6.qnssl.com/images/logo-with-R.9c82.png" width="300" height="96"/>

[加入我们](https://www.bmqb.com/a/jobs)

## License

MIT license.
Loading

0 comments on commit d1a4845

Please sign in to comment.