Browse Source

Merge branch 'master' of dd.tall.wiki:ccsens_fe/bird-go-home

master
wally 4 years ago
parent
commit
3e5cde11a8
  1. 156
      README.md
  2. BIN
      public/RECOVER_鸟妈妈回家_HTML5 Canvas.fla
  3. 42
      public/bird.js
  4. BIN
      public/images/stopDemo.png
  5. BIN
      public/images/suspend.png
  6. BIN
      public/恢复_鸟妈妈回家_HTML5 Canvas.fla
  7. BIN
      public/鸟妈妈回家_HTML5 Canvas.fla
  8. 1
      src/classes/demo.js
  9. 40
      src/classes/suspend.js
  10. 1
      src/custom.js
  11. 7
      src/test.js

156
README.md

@ -43,72 +43,96 @@ tree -I "node_modules|package-lock.json|yarn.lock"
```bash ```bash
. │ .gitignore
├── README.md │ .prettierrc
├── dist │ .svrxrc.js
│   ├── bird.js │ dist.zip
│   ├── images │ gulpfile.js
│   │   ├── Bitmap1.png │ package-lock.json
│   │   ├── Bitmap2.png │ package.json
│   │   ├── Bitmap3.png │ README.md
│   │   ├── Bitmap4.png
│   │   ├── Bitmap5.png ├─dist
│   │   ├── _preloader.gif │ │ bird.js
│   │   ├── level.png │ │ index.html
│   │   ├── 任务完成_.png │ │ main.js
│   │   ├── 倒计时_.png │ │
│   │   ├── 树林前景_.png │ ├─images
│   │   ├── 计时_.png │ │ Bitmap1.png
│   │   └── 返回按钮_.png │ │ Bitmap2.png
│   ├── index.html │ │ Bitmap3.png
│   ├── libs │ │ Bitmap4.png
│   │   └── 1.0.0 │ │ Bitmap5.png
│   │   └── createjs.min.js │ │ level.png
│   ├── main.js │ │ stopDemo.png
│   └── sounds │ │ suspend.png
│   ├── amazing.mp3 │ │ _preloader.gif
│   ├── bgmMusic.mp3 │ │ 任务完成_.png
│   ├── excitationMusic.mp3 │ │ 倒计时_.png
│   └── unbelievable.mp3 │ │ 再来一次_.png
├── gulpfile.js │ │ 树林前景_.png
├── package.json │ │ 计时_.png
├── public │ │ 返回按钮_.png
│   ├── bird.html │ │
│   ├── bird.js │ ├─libs
│   ├── images │ │ └─1.0.0
│   │   ├── Bitmap1.png │ │ createjs.min.js
│   │   ├── Bitmap2.png │ │
│   │   ├── Bitmap3.png │ └─sounds
│   │   ├── Bitmap4.png │ amazing.mp3
│   │   ├── Bitmap5.png │ bgmMusic.mp3
│   │   ├── _preloader.gif │ excitationMusic.mp3
│   │   ├── level.png │ unbelievable.mp3
│   │   ├── 任务完成_.png
│   │   ├── 倒计时_.png ├─public
│   │   ├── 树林前景_.png │ │ bird.html
│   │   ├── 计时_.png │ │ bird.js
│   │   └── 返回按钮_.png │ │ index.html
│   ├── index.html │ │ 鸟妈妈回家_HTML5 Canvas.fla
│   ├── libs │ │
│   │   └── 1.0.0 │ ├─images
│   │   └── createjs.min.js │ │ Bitmap1.png
│   ├── sounds │ │ Bitmap2.png
│   │   ├── amazing.mp3 │ │ Bitmap3.png
│   │   ├── bgmMusic.mp3 │ │ Bitmap4.png
│   │   ├── excitationMusic.mp3 │ │ Bitmap5.png
│   │   └── unbelievable.mp3 │ │ level.png
│   └── 鸟妈妈回家_HTML5 Canvas.fla │ │ stopDemo.png
└── src │ │ suspend.png
├── classes │ │ _preloader.gif
│   ├── back.js │ │ 任务完成_.png
│   ├── count.js │ │ 倒计时_.png
│   ├── end.js │ │ 再来一次_.png
│   ├── level.js │ │ 树林前景_.png
│   ├── main.js │ │ 计时_.png
│   ├── sound.js │ │ 返回按钮_.png
│   └── time.js │ │
├── custom.js │ ├─libs
└── index.js │ │ └─1.0.0
│ │ createjs.min.js
│ │
│ └─sounds
│ amazing.mp3
│ bgmMusic.mp3
│ excitationMusic.mp3
│ unbelievable.mp3
└─src
│ custom.js
│ index.js
│ test.js
└─classes
again.js
back.js
count.js
demo.js
end.js
level.js
main.js
sound.js
suspend.js
time.js
``` ```
| 文件 | 说明 | 备注 | | 文件 | 说明 | 备注 |

BIN
public/RECOVER_鸟妈妈回家_HTML5 Canvas.fla

Binary file not shown.

42
public/bird.js

@ -76,7 +76,13 @@ p.nominalBounds = new cjs.Rectangle(0,0,449,161);
(lib.stopDemo = function() { (lib.stopDemo = function() {
this.initialize(img.stopDemo); this.initialize(img.stopDemo);
}).prototype = p = new cjs.Bitmap(); }).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,161,57); p.nominalBounds = new cjs.Rectangle(0,0,107,42);
(lib.suspend = function() {
this.initialize(img.suspend);
}).prototype = p = new cjs.Bitmap();
p.nominalBounds = new cjs.Rectangle(0,0,107,43);
(lib.任务完成 = function() { (lib.任务完成 = function() {
@ -156,6 +162,28 @@ if (reversed == null) { reversed = false; }
}).prototype = getMCSymbolPrototype(lib.timeBg, new cjs.Rectangle(-60,-49,120,98.9), null); }).prototype = getMCSymbolPrototype(lib.timeBg, new cjs.Rectangle(-60,-49,120,98.9), null);
(lib.Suspend = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; }
var props = new Object();
props.mode = mode;
props.startPosition = startPosition;
props.labels = {};
props.loop = loop;
props.reversed = reversed;
cjs.MovieClip.apply(this,[props]);
// 图层_1
this.instance = new lib.suspend();
this.instance.setTransform(37,-21);
this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));
this._renderFirstFrame();
}).prototype = getMCSymbolPrototype(lib.Suspend, new cjs.Rectangle(37,-21,107,43), null);
(lib.stopDemo_1 = function(mode,startPosition,loop,reversed) { (lib.stopDemo_1 = function(mode,startPosition,loop,reversed) {
if (loop == null) { loop = true; } if (loop == null) { loop = true; }
if (reversed == null) { reversed = false; } if (reversed == null) { reversed = false; }
@ -169,13 +197,13 @@ if (reversed == null) { reversed = false; }
// 图层_1 // 图层_1
this.instance = new lib.stopDemo(); this.instance = new lib.stopDemo();
this.instance.setTransform(-79,-28); this.instance.setTransform(129,-20);
this.timeline.addTween(cjs.Tween.get(this.instance).wait(1)); this.timeline.addTween(cjs.Tween.get(this.instance).wait(1));
this._renderFirstFrame(); this._renderFirstFrame();
}).prototype = getMCSymbolPrototype(lib.stopDemo_1, new cjs.Rectangle(-79,-28,161,57), null); }).prototype = getMCSymbolPrototype(lib.stopDemo_1, new cjs.Rectangle(129,-20,107,42), null);
(lib.前景 = function(mode,startPosition,loop,reversed) { (lib.前景 = function(mode,startPosition,loop,reversed) {
@ -2142,19 +2170,16 @@ if (reversed == null) { reversed = false; }
this.frame_621 = function() { this.frame_621 = function() {
this.stop() this.stop()
} }
this.frame_643 = function() {
this.stop()
}
// actions tween: // actions tween:
this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(16).call(this.frame_16).wait(38).call(this.frame_54).wait(54).call(this.frame_108).wait(26).call(this.frame_134).wait(25).call(this.frame_159).wait(34).call(this.frame_193).wait(54).call(this.frame_247).wait(25).call(this.frame_272).wait(24).call(this.frame_296).wait(25).call(this.frame_321).wait(25).call(this.frame_346).wait(27).call(this.frame_373).wait(63).call(this.frame_436).wait(23).call(this.frame_459).wait(27).call(this.frame_486).wait(26).call(this.frame_512).wait(25).call(this.frame_537).wait(24).call(this.frame_561).wait(24).call(this.frame_585).wait(36).call(this.frame_621).wait(22).call(this.frame_643).wait(861)); this.timeline.addTween(cjs.Tween.get(this).call(this.frame_0).wait(16).call(this.frame_16).wait(38).call(this.frame_54).wait(54).call(this.frame_108).wait(26).call(this.frame_134).wait(25).call(this.frame_159).wait(34).call(this.frame_193).wait(54).call(this.frame_247).wait(25).call(this.frame_272).wait(24).call(this.frame_296).wait(25).call(this.frame_321).wait(25).call(this.frame_346).wait(27).call(this.frame_373).wait(63).call(this.frame_436).wait(23).call(this.frame_459).wait(27).call(this.frame_486).wait(26).call(this.frame_512).wait(25).call(this.frame_537).wait(24).call(this.frame_561).wait(24).call(this.frame_585).wait(36).call(this.frame_621).wait(883));
// mask // mask
this.shape = new cjs.Shape(); this.shape = new cjs.Shape();
this.shape.graphics.f("#000000").s().p("EjxyDCfMAAAmE9MHjlAAAMAAAGE9gEh1CBEhMDH/AAAMAAAhwfMh1rAAAIABAAMg5XAAAIAAAAI4+AAg"); this.shape.graphics.f("#000000").s().p("EjxyDCfMAAAmE9MHjlAAAMAAAGE9gEh1CBEhMDH/AAAMAAAhwfMh1rAAAIABAAMg5XAAAIAAAAI4+AAg");
this.shape.setTransform(749.1,281.525); this.shape.setTransform(749.1,281.525);
this.timeline.addTween(cjs.Tween.get(this.shape).to({_off:true},1500).wait(4)); this.timeline.addTween(cjs.Tween.get(this.shape).wait(713).to({_off:true},787).wait(4));
// score // score
this.instance = new lib._218d7f87fgfh("single",20); this.instance = new lib._218d7f87fgfh("single",20);
@ -2267,6 +2292,7 @@ lib.properties = {
{src:"images/Bitmap5.png", id:"Bitmap5"}, {src:"images/Bitmap5.png", id:"Bitmap5"},
{src:"images/level.png", id:"level"}, {src:"images/level.png", id:"level"},
{src:"images/stopDemo.png", id:"stopDemo"}, {src:"images/stopDemo.png", id:"stopDemo"},
{src:"images/suspend.png", id:"suspend"},
{src:"images/任务完成_.png", id:"任务完成"}, {src:"images/任务完成_.png", id:"任务完成"},
{src:"images/再来一次_.png", id:"再来一次"}, {src:"images/再来一次_.png", id:"再来一次"},
{src:"images/计时_.png", id:"计时"}, {src:"images/计时_.png", id:"计时"},

BIN
public/images/stopDemo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
public/images/suspend.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
public/恢复_鸟妈妈回家_HTML5 Canvas.fla

Binary file not shown.

BIN
public/鸟妈妈回家_HTML5 Canvas.fla

Binary file not shown.

1
src/classes/demo.js

@ -34,6 +34,7 @@ Demo.prototype.showStopDemo = function () {
stage.removeChild(stopDemo); stage.removeChild(stopDemo);
location.hash = ''; location.hash = '';
location.reload(); location.reload();
isDemo = false;
}, },
false, false,
); );

40
src/classes/suspend.js

@ -0,0 +1,40 @@
/**
* 暂停游戏类暂停继续游戏
* @property {object} lib 库对象
* @property {object} suspend 面板元素对象
*/
function Suspend() {
this.lib = library;
this.suspend = null;
}
Suspend.of = function () {
const instance = new Suspend();
instance.init();
return instance;
};
// 初始化
Suspend.prototype.init = function () {
this.suspendGame();
};
// 暂停游戏按钮
Suspend.prototype.suspendGame = function () {
const lib = this.lib;
const suspend = new lib.suspend();
suspend.x = 180;
suspend.y = lib.properties.height - 100;
this.suspend = suspend;
// 关闭演示模式
this.suspend.addEventListener(
'click',
function () {
console.log('暂停游戏');
stage.removeChild(stopDemo);
},
false,
);
stage.addChild(suspend);
};

1
src/custom.js

@ -8,6 +8,7 @@ const config = {
let library = null; let library = null;
let state = 0; // 游戏状态 0->未开始 1->进行中 2->结束 let state = 0; // 游戏状态 0->未开始 1->进行中 2->结束
let isDemo = false; // 是不是演示模式
function initStage(lib) { function initStage(lib) {
library = lib; library = lib;

7
src/test.js

@ -1,6 +1,7 @@
// 判断是否在演示模式 能否直接开始游戏 // 判断是否在演示模式 能否直接开始游戏
function isHash() { function isHash() {
if (location.hash && location.hash === 'p') { if (location.hash && location.hash === '#p') {
isDemo = true;
Demo.of(); Demo.of();
Count.of(countOver); Count.of(countOver);
} else { } else {
@ -13,6 +14,7 @@ function startGame() {
var count = 0, var count = 0,
timer; timer;
document.onclick = function () { document.onclick = function () {
if (isDemo) return;
if (count < 6) { if (count < 6) {
if (timer) { if (timer) {
clearTimeout(timer); clearTimeout(timer);
@ -30,6 +32,7 @@ function startGame() {
} }
function sevenClick() { function sevenClick() {
isDemo = true;
Count.of(countOver); Count.of(countOver);
addHash(); addHash();
} }
@ -41,7 +44,7 @@ function countOver() {
// 添加hash值 // 添加hash值
function addHash() { function addHash() {
location.hash = 'p'; location.hash = '#p';
Demo.of(); Demo.of();
} }

Loading…
Cancel
Save