GithubHelp home page GithubHelp logo

sohokay / tower_game Goto Github PK

View Code? Open in Web Editor NEW

This project forked from iamkun/tower_game

0.0 1.0 0.0 1.67 MB

💒盖楼游戏 html5 canvas tower building game 🏢🏬🏦🏯🏰

Home Page: http://fe.bmqb.com/tower_game/demo.html

License: MIT License

HTML 29.11% JavaScript 70.89%

tower_game's Introduction

LICENSE

盖楼游戏

一个基于 Canvas 的盖楼游戏

Tower Building Game (Tower Bloxx Deluxe Skyscraper)

Demo 预览

手机设备可以扫描下方二维码

Game Rule 游戏规则

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

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

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

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

Customise 自定义

git clone https://github.com/bmqb/tower_game.git
cd tower_game
npm install
npm start

打开 http://localhost:8082

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

Option 自定义选项

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

Option Type Description
width number 游戏主画面宽度
height number 游戏主画面高度
canvasId string Canvas 的 DOM ID
soundOn boolean 是否开启声音
successScore number 成功盖楼分数
perfectScore number 完美盖楼额外奖励分数
hookSpeed function 钩子平移速度
hookAngle function 钩子摆动角度
landBlockSpeed function 下方楼房横向速度
setGameScore function 当前游戏分数hook
setGameSuccess function 当前游戏成功次数hook
setGameFailed 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
}

License

MIT license.

tower_game's People

Contributors

iamkun avatar

Watchers

James Cloos 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.