【实例简介】福仔消消乐
三消游戏
【实例截图】
on_onFall() {
this.on_checkGenerateProp(this._score.chain).then(() => {
let self = this
let canFall = 0
//从每一列的最下面一个开始往上判断
//如果有空 就判断有几个空 然后让最上方的方块掉落下来
for (let j = this.rowNum - 1; j >= 0; j--) {
canFall = 0
for (let i = this.rowNum - 1; i >= 0; i--) {
if (this.map[i][j].getComponent('cell')._status == 2) {
this.blockPool.put(this.map[i][j])
this.map[i][j] = null
canFall
} else {
if (canFall != 0) {
this.map[i canFall][j] = this.map[i][j]
this.map[i][j] = null
this.map[i canFall][j].getComponent('cell').playFallAction(canFall, {
x: j,
y: i canFall,
})
}
}
}
for (var k = 0; k < canFall; k ) {
this.map[k][j] = this.on_instantiateBlock(this, {
x: j,
y: k,
width: this.blockWidth,
startTime: null
}, this.blocksContainer, '', {
x: j,
y: -canFall k
})
this.map[k][j].getComponent('cell').playFallAction(canFall, null)
}
}
setTimeout(() => {
this.checkMgr.init(this)
this.checkMgr.check(this)
this._status = 1
}, 250)
})
},
on_gameOver() {
this._status = 3
this._controller.pageMgr.on_addPage(2)
this._controller.pageMgr.on_addPage(4)
if (this._controller.social.node.active) {
this._controller.social.closeBannerAdv()
}
},
// todo 复活
askRevive() {
this._controller.pageMgr.on_addPage(2)
this._controller.pageMgr.on_addPage(5)
this.revivePage.active = true
this.revivePage.getChildByName('askRevive').active = true
this.revivePage.getChildByName('successRevive').active = false
this.rangeSprite = this.revivePage.getChildByName('askRevive').getChildByName('numBg').getChildByName('sprite').getComponent(cc.Sprite)
this.rangeSprite.fillRange = 1
this.isRangeAction = true
let numLabel = this.revivePage.getChildByName('askRevive').getChildByName('numBg').getChildByName('num').getComponent(cc.Label)
numLabel.string = 9
if (this.reviveTimer) {
clearInterval(this.reviveTimer)
}
this.reviveTimer = setInterval(() => {
if ( numLabel.string > 0) {
numLabel.string--
this.rangeSprite.fillRange = 1
} else {
this.on_onSkipRevive()
}
}, 1000)
},
on_onReviveCertainBtn() {
this._controller.pageMgr.on_removePage(2)
this.revivePage.active = false
this._status = 1
this._score.onRevive()
},
on_onSkipRevive() {
clearInterval(this.reviveTimer)
this._controller.pageMgr.pages[5].active = false
this._score.onon_gameOver(true)
this.isRangeAction = false
//yang
//yang 查看排行是否显示
},
on_onReviveButton() {
clearInterval(this.reviveTimer)
this.isRangeAction = false
// if (this._controller.social.node.active) {
// this._controller.social.on_onReviveButton(1)
// } else {
// this.on_showReviveSuccess()
// }
this.on_showReviveSuccess()
},
【核心代码】
.
└── 福仔消消乐_game.js
0 directories, 1 file
网友评论
我要评论