Commit cd4c30f3 authored by Master Q's avatar Master Q

游戏数据调试

parent ac2e77f9
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<!-- <script src="libs/svgaParser.min1.js"></script> --> <!-- <script src="libs/svgaParser.min1.js"></script> -->
<script src="//yun.duiba.com.cn/js-libs/vConsole/3.3.4/vconsole.min.js"></script> <script src="//yun.duiba.com.cn/js-libs/vConsole/3.3.4/vconsole.min.js"></script>
<script> <script>
// var vConsole = new VConsole(); var vConsole = new VConsole();
</script> </script>
<style> <style>
html, html,
......
resource/GameScene/p1-b.png

13.5 KB | W: | H:

resource/GameScene/p1-b.png

12.2 KB | W: | H:

resource/GameScene/p1-b.png
resource/GameScene/p1-b.png
resource/GameScene/p1-b.png
resource/GameScene/p1-b.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/p1.png

30.8 KB | W: | H:

resource/GameScene/p1.png

107 KB | W: | H:

resource/GameScene/p1.png
resource/GameScene/p1.png
resource/GameScene/p1.png
resource/GameScene/p1.png
  • 2-up
  • Swipe
  • Onion skin
This diff is collapsed.
...@@ -3,7 +3,7 @@ export const GameCfg = { ...@@ -3,7 +3,7 @@ export const GameCfg = {
ispeed: 0, // 初速度 ispeed: 0, // 初速度
fpsScale: 1000 / 60, // 帧变数 fpsScale: 1000 / 60, // 帧变数
resisteAcc: 0.06, // 摩擦力反加速度 resisteAcc: 0.06, // 摩擦力反加速度
rc: 20, // 误差值,距离中心点的误差值 rc: 40, // 误差值,距离中心点的误差值
duanpingValue: 8 / 180 * Math.PI, // 默认小于 8 度就算端平 duanpingValue: 8 / 180 * Math.PI, // 默认小于 8 度就算端平
iTime: 12000, // 初始化游戏时间 iTime: 12000, // 初始化游戏时间
......
...@@ -100,7 +100,7 @@ export class GameScene extends MotionInitScene { ...@@ -100,7 +100,7 @@ export class GameScene extends MotionInitScene {
this.cdp.addTimeoutFunc(() => { this.cdp.addTimeoutFunc(() => {
// this.cdp.visible = false // this.cdp.visible = false
//@ts-ignore //@ts-ignore
my.showToast({ my && my.showToast({
content: '游戏结束' content: '游戏结束'
}) })
}) })
...@@ -112,7 +112,7 @@ export class GameScene extends MotionInitScene { ...@@ -112,7 +112,7 @@ export class GameScene extends MotionInitScene {
initGame() { initGame() {
this.cdp.start() this.cdp.start()
this.gameEle = this.addChild(new GameEle('p1-b.png', this.centerp, () => { this.gameEle = this.addChild(new GameEle('p1.png', this.centerp, () => {
this.score += 1 this.score += 1
this.gIndex += 1 this.gIndex += 1
this.cdp.initTime = GameCfg.iTime this.cdp.initTime = GameCfg.iTime
...@@ -138,20 +138,6 @@ export class GameScene extends MotionInitScene { ...@@ -138,20 +138,6 @@ export class GameScene extends MotionInitScene {
} }
var posList = [
{
x: 0, y: layers.stageHeight + layers.stageOffsetY
},
{
x: layers.stageWidth + layers.stageOffsetX,
y: 0
},
{
x: layers.stageWidth + layers.stageOffsetX,
y: layers.stageHeight + layers.stageOffsetY
}
]
export class GameEle extends Container { export class GameEle extends Container {
rorate:number // 旋转角度 rorate:number // 旋转角度
vx = GameCfg.ispeed // 当前x速度, 有初速度 vx = GameCfg.ispeed // 当前x速度, 有初速度
...@@ -182,7 +168,21 @@ export class GameEle extends Container { ...@@ -182,7 +168,21 @@ export class GameEle extends Container {
initUi(tn: string) { initUi(tn: string) {
if (tn) { if (tn) {
this.sprite = UI.Sp(this, tn) this.sprite = UI.Sp(this, tn)
var posList = [
{
x: 0, y: layers.stageHeight + layers.stageOffsetY
},
{
x: layers.stageWidth + layers.stageOffsetX,
y: 0
},
{
x: layers.stageWidth + layers.stageOffsetX,
y: layers.stageHeight + layers.stageOffsetY
}
]
var pos = posList[Math.floor(Math.random() * 3)] var pos = posList[Math.floor(Math.random() * 3)]
console.log(posList, pos)
this.position.set(pos.x, pos.y) this.position.set(pos.x, pos.y)
// this.sprite.scaleX = 0.5 // this.sprite.scaleX = 0.5
// this.sprite.scaleY = 0.5 // this.sprite.scaleY = 0.5
...@@ -200,6 +200,19 @@ export class GameEle extends Container { ...@@ -200,6 +200,19 @@ export class GameEle extends Container {
resetInit(tName: string) { resetInit(tName: string) {
this.sprite.texture = RES.getRes(tName) this.sprite.texture = RES.getRes(tName)
var posList = [
{
x: 0, y: layers.stageHeight + layers.stageOffsetY
},
{
x: layers.stageWidth + layers.stageOffsetX,
y: 0
},
{
x: layers.stageWidth + layers.stageOffsetX,
y: layers.stageHeight + layers.stageOffsetY
}
]
var pos = posList[Math.floor(Math.random() * 3)] var pos = posList[Math.floor(Math.random() * 3)]
this.position.set(pos.x, pos.y) this.position.set(pos.x, pos.y)
...@@ -296,16 +309,53 @@ export class GameEle extends Container { ...@@ -296,16 +309,53 @@ export class GameEle extends Container {
this.setRotation(this.k * (len - GameCfg.rc)) this.setRotation(this.k * (len - GameCfg.rc))
if (this.isIn) { if (this.isIn) {
this.isIn = false this.isIn = false
FYGE.Tween.removeTweens(this)
GDispatcher.dispatchEvent('focus-out') GDispatcher.dispatchEvent('focus-out')
} }
} else { } else {
if (!this.isIn) { if (!this.isIn) {
this.isIn = true this.isIn = true
this.vx = 0
this.vy = 0
this.setRotation(0)
FYGE.Tween.get(this)
.to({
x: this.fixedCenter.x,
y: this.fixedCenter.y
}, 400)
GDispatcher.dispatchEvent('focus-in', () => { GDispatcher.dispatchEvent('focus-in', () => {
this.finishFunc() this.finishFunc()
}) })
} }
} }
// var len = pos2Len(this, this.fixedCenter)
// if (!this.lastLen) this.lastLen = len
// if (len > this.lastLen && this.isIn) {
// this.isIn = false
// FYGE.Tween.removeTweens(this)
// GDispatcher.dispatchEvent('focus-out')
// }
// this.lastLen = len
// this.setRotation(this.k * (len - 20)) // vtodo 最后20 只是平移
// if (len <= GameCfg.rc) {
// if (!this.isIn) {
// this.isIn = true
// this.vx = 0
// this.vy = 0
// this.setRotation(0)
// FYGE.Tween.get(this)
// .to({
// x: this.fixedCenter.x,
// y: this.fixedCenter.y
// }, 400)
// GDispatcher.dispatchEvent('focus-in', () => {
// this.finishFunc()
// })
// }
// }
} }
update() { update() {
......
...@@ -123,6 +123,15 @@ export class MotionInitScene extends Scene { ...@@ -123,6 +123,15 @@ export class MotionInitScene extends Scene {
.arc(layers.stageCenterX, layers.stageCenterY, 240, 0, 2*Math.PI) .arc(layers.stageCenterX, layers.stageCenterY, 240, 0, 2*Math.PI)
.endFill() .endFill()
this.focusProgress = this.addChild(new CircleProgressBar({
x: layers.stageCenterX,
y: layers.stageCenterY, // vtodo 这里后面可能会调试
radius: 260,
lineWidth: 15,
value: 0
}))
this.focusProgress.visible = false
this.centerp = setCenterPos(UI.Sp(this, 'p1-b.png')) this.centerp = setCenterPos(UI.Sp(this, 'p1-b.png'))
var bitMapc = Tools.getNumTextures('num') var bitMapc = Tools.getNumTextures('num')
...@@ -175,13 +184,8 @@ export class MotionInitScene extends Scene { ...@@ -175,13 +184,8 @@ export class MotionInitScene extends Scene {
// type: 'fill', // type: 'fill',
// typeColor: 0x111111 // typeColor: 0x111111
// })) // }))
this.focusProgress = this.addChild(new CircleProgressBar({ this.focusProgress.visible = true
x: layers.stageCenterX, this.bitmapTextCount.visible = true
y: layers.stageCenterY, // vtodo 这里后面可能会调试
radius: 260,
lineWidth: 15,
value: 0
}))
FYGE.Tween.get(this.holdOnTxt) FYGE.Tween.get(this.holdOnTxt)
.set({visible: true, alpha: 0.4}) .set({visible: true, alpha: 0.4})
...@@ -192,6 +196,7 @@ export class MotionInitScene extends Scene { ...@@ -192,6 +196,7 @@ export class MotionInitScene extends Scene {
this.bitmapTextCount.text = ((this.focusProgress.value * 100) >> 0) + "%" this.bitmapTextCount.text = ((this.focusProgress.value * 100) >> 0) + "%"
} }
}) })
.set({value: 0})
.to({value: 1}, 3000) .to({value: 1}, 3000)
.call(() => { .call(() => {
console.log('%c 成功套种', 'color: green') console.log('%c 成功套种', 'color: green')
...@@ -202,11 +207,11 @@ export class MotionInitScene extends Scene { ...@@ -202,11 +207,11 @@ export class MotionInitScene extends Scene {
}, 400) }, 400)
removeTimeCountDown() { removeTimeCountDown() {
if (this.focusProgress) { if (this.focusProgress.visible) {
this.unshoot() this.unshoot()
FYGE.Tween.removeTweens(this.focusProgress) FYGE.Tween.removeTweens(this.focusProgress)
this.removeChild(this.focusProgress) this.focusProgress.visible = false
this.bitmapTextCount.text = '' this.bitmapTextCount.visible = false
} }
FYGE.Tween.removeTweens(this.holdOnTxt) FYGE.Tween.removeTweens(this.holdOnTxt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment