Skip to content

Commit f039786

Browse files
committedNov 10, 2017
🎑 游戏转场
1 parent 55a78e8 commit f039786

File tree

9 files changed

+1440
-262
lines changed

9 files changed

+1440
-262
lines changed
 

‎assets/Scene/End.fire

+1,067-2
Large diffs are not rendered by default.

‎assets/Scene/Game.fire

+311-254
Large diffs are not rendered by default.

‎assets/Scene/Start.fire

+1-1
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@
445445
},
446446
"_contentSize": {
447447
"__type__": "cc.Size",
448-
"width": 300,
448+
"width": 280,
449449
"height": 80
450450
},
451451
"_rotationX": 0,

‎assets/Script/End.meta

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ver": "1.0.1",
3+
"uuid": "86e3e9da-0f80-44b3-85ff-71c2b577fe71",
4+
"subMetas": {}
5+
}

‎assets/Script/End/end.js

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
cc.Class({
2+
extends: cc.Component,
3+
4+
properties: {
5+
newScore: {
6+
default: null,
7+
type: cc.Label,
8+
},
9+
restartBtn: {
10+
default: null,
11+
type: cc.Button,
12+
},
13+
historyBtn: {
14+
default: null,
15+
type: cc.Button,
16+
},
17+
quitBtn: {
18+
default: null,
19+
type: cc.Button,
20+
}
21+
},
22+
23+
// use this for initialization
24+
onLoad: function () {
25+
this.newScore.string = D.commonState.gameScore ? D.commonState.gameScore.toString() : '0';
26+
},
27+
restartGame: function () {
28+
cc.director.loadScene('Game');
29+
},
30+
quitGame: function () {
31+
cc.director.loadScene('Start');
32+
},
33+
34+
35+
// called every frame, uncomment this function to activate update callback
36+
// update: function (dt) {
37+
38+
// },
39+
});

‎assets/Script/End/end.js.meta

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"ver": "1.0.5",
3+
"uuid": "a8ea067e-277e-4e37-aa5b-aba4f8c00006",
4+
"isPlugin": false,
5+
"loadPluginInWeb": true,
6+
"loadPluginInNative": true,
7+
"loadPluginInEditor": false,
8+
"subMetas": {}
9+
}

‎assets/Script/Game/hero.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ cc.Class({
5757
}
5858
},
5959
onHandleDestroy: function () {
60-
// this.node.destroy();
6160
// 暂停正在运行的场景,该暂停只会停止游戏逻辑执行,但是不会停止渲染和 UI 响应
6261
this.offDrag();
63-
// this.pause();
64-
cc.director.pause();
62+
// 游戏结束转场
63+
this.mainScript.gameOver();
6564
}
6665

6766
// called every frame, uncomment this function to activate update callback

‎assets/Script/Game/main.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ cc.Class({
8383
changeScore: function (score) {
8484
D.commonState.gameScore += score;
8585
this.scoreDisplay.string = D.commonState.gameScore.toString();
86-
}
86+
},
87+
// 游戏结束
88+
gameOver: function () {
89+
cc.director.loadScene('End');
90+
},
8791

8892
// called every frame, uncomment this function to activate update callback
8993
// update: function (dt) {

‎assets/Script/Start/start.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ cc.Class({
2020
},
2121

2222
startGame: function () {
23-
console.log('game start')
23+
// 转场
2424
cc.director.loadScene('Game');
2525
}
2626

0 commit comments

Comments
 (0)
Please sign in to comment.