Commit 39dfa31b authored by Master Q's avatar Master Q

question

parent cd4c30f3
resource/GameScene/num0.png

811 Bytes | W: | H:

resource/GameScene/num0.png

33.6 KB | W: | H:

resource/GameScene/num0.png
resource/GameScene/num0.png
resource/GameScene/num0.png
resource/GameScene/num0.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num1.png

170 Bytes | W: | H:

resource/GameScene/num1.png

15 KB | W: | H:

resource/GameScene/num1.png
resource/GameScene/num1.png
resource/GameScene/num1.png
resource/GameScene/num1.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num2.png

710 Bytes | W: | H:

resource/GameScene/num2.png

29.2 KB | W: | H:

resource/GameScene/num2.png
resource/GameScene/num2.png
resource/GameScene/num2.png
resource/GameScene/num2.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num3.png

756 Bytes | W: | H:

resource/GameScene/num3.png

31.7 KB | W: | H:

resource/GameScene/num3.png
resource/GameScene/num3.png
resource/GameScene/num3.png
resource/GameScene/num3.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num4.png

451 Bytes | W: | H:

resource/GameScene/num4.png

25.4 KB | W: | H:

resource/GameScene/num4.png
resource/GameScene/num4.png
resource/GameScene/num4.png
resource/GameScene/num4.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num5.png

685 Bytes | W: | H:

resource/GameScene/num5.png

29.7 KB | W: | H:

resource/GameScene/num5.png
resource/GameScene/num5.png
resource/GameScene/num5.png
resource/GameScene/num5.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num6.png

760 Bytes | W: | H:

resource/GameScene/num6.png

29.5 KB | W: | H:

resource/GameScene/num6.png
resource/GameScene/num6.png
resource/GameScene/num6.png
resource/GameScene/num6.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num7.png

581 Bytes | W: | H:

resource/GameScene/num7.png

23.7 KB | W: | H:

resource/GameScene/num7.png
resource/GameScene/num7.png
resource/GameScene/num7.png
resource/GameScene/num7.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num8.png

824 Bytes | W: | H:

resource/GameScene/num8.png

35.2 KB | W: | H:

resource/GameScene/num8.png
resource/GameScene/num8.png
resource/GameScene/num8.png
resource/GameScene/num8.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/num9.png

753 Bytes | W: | H:

resource/GameScene/num9.png

30.2 KB | W: | H:

resource/GameScene/num9.png
resource/GameScene/num9.png
resource/GameScene/num9.png
resource/GameScene/num9.png
  • 2-up
  • Swipe
  • Onion skin
resource/GameScene/nump.png

1.15 KB | W: | H:

resource/GameScene/nump.png

20.4 KB | W: | H:

resource/GameScene/nump.png
resource/GameScene/nump.png
resource/GameScene/nump.png
resource/GameScene/nump.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -4,16 +4,20 @@
"keys": "countdown-back.png",
"name": "CountDownComp"
},
{
"keys": "back-home.png,more-btn.png,new-record-icon.png,share-btn.png",
"name": "GameOver"
},
{
"keys": "back_index.png,gg_back.png,one_more-btn.png",
"name": "GameOverPanel"
},
{
"keys": "back.png,balance_guidance.png,guidance-t1.png,num0.png,num1.png,num2.png,num3.png,num4.png,num5.png,num6.png,num7.png,num8.png,num9.png,nump.png,p1-b.png,p1.png,p10-b.png,p10.png,p11-b.png,p11.png,p12-b.png,p12.png,p13-b.png,p13.png,p14-b.png,p14.png,p15-b.png,p15.png,p16-b.png,p16.png,p17-b.png,p17.png,p18-b.png,p18.png,p19-b.png,p19.png,p2-b.png,p2.png,p20-b.png,p20.png,p3-b.png,p3.png,p4-b.png,p4.png,p5-b.png,p5.png,p6-b.png,p6.png,p7-b.png,p7.png,p8-b.png,p8.png,p9-b.png,p9.png",
"keys": "balance_guidance.png,guidance-t1.png,num0.png,num1.png,num2.png,num3.png,num4.png,num5.png,num6.png,num7.png,num8.png,num9.png,numb0.png,numb1.png,numb2.png,numb3.png,numb4.png,numb5.png,numb6.png,numb7.png,numb8.png,numb9.png,numbp.png,nump.png,p1-b.png,p1.png,p10-b.png,p10.png,p11-b.png,p11.png,p12-b.png,p12.png,p13-b.png,p13.png,p14-b.png,p14.png,p15-b.png,p15.png,p16-b.png,p16.png,p17-b.png,p17.png,p18-b.png,p18.png,p19-b.png,p19.png,p2-b.png,p2.png,p20-b.png,p20.png,p3-b.png,p3.png,p4-b.png,p4.png,p5-b.png,p5.png,p6-b.png,p6.png,p7-b.png,p7.png,p8-b.png,p8.png,p9-b.png,p9.png",
"name": "GameScene"
},
{
"keys": "comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"keys": "back.png,comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"name": "common"
}
],
......
......@@ -11,6 +11,7 @@ import { Tools } from "./Tools";
import { GameScene } from "./scenes/GameScene/GameScene";
import { cusPlaySound, Soundurl, stopAllSound } from "./SoundWeb";
import { NewGuyScene } from "./scenes/NewGuyScene/NewGuyScene";
import { GameOverScene } from "./scenes/GameOverScene/GameOverScene";
/**
* 全局事件,为了和小程序交互
......@@ -176,9 +177,14 @@ export class Main {
// }
// const scene = Tools.globalData.newUser ? StoryScene : IndexScene;
// , {
// score: 45,
// isNewRecord: true,
// productLink: 'http://qnpic.top/yoona2.jpg',
// isWinPrize: false
// }
// vtodo 是否是新手
changeScene(NewGuyScene);
changeScene(GameScene);
// MusicBtn.changeMusicStatus(true); // TODO 进游戏打开音乐先
......
This diff is collapsed.
import { layers } from "../../../module/views/layers";
import { Scene } from "../../../module/views/Scene";
import { Tools } from "../../Tools";
import UI from "../../UI";
export class GameOverScene extends Scene {
bitmapTextCount: FYGE.BitmapText
get groupNames():string[] {
return ['GameOver', 'GameScene']
}
constructor(...args:any) {
super(...args)
}
initUi() {
UI.Sp(this, 'back.png')
var bitMapc = Tools.getNumTextures('num')
this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc))
this.bitmapTextCount.position.set(layers.stageCenterX, 500)
this.bitmapTextCount.text = this.data.score + ''
var desc = UI.Ctn(this, 0, 700)
UI.Txt(desc, '本局连续完成', 36, '#111111', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, 0)
UI.Txt(desc, '游戏结束', 30, '#757575', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, 50)
this.data.isNewRecord && UI.Sp(desc, 'new-record-icon.png', 490, -30)
UI.Btn(this, 'share-btn.png', function() {
console.log('点击了分享')
}, this, 45, 950)
UI.Btn(this, 'more-btn.png', function() {
console.log('点击了再来一次')
}, this, 45, 1110)
var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1350)
_s.anchorTexture.set(0.5, 0.5)
}
}
\ No newline at end of file
import { ProgressBar } from './../../common/ProgressBar';
import { layers } from './../../../module/views/layers';
import { Scene } from "../../../module/views/Scene"
import UI from "../../UI"
import { GameCfg } from './GameConfig';
import deviceMotionSubs from './DeviceMotion';
import { GDispatcher } from '../../Main';
import { MotionInitFunc, MotionInitScene } from './MotionInit';
import { setCenterPos } from '../NewGuyScene/NewGuyScene';
import CountDownComp from '../../components/CountDownComp';
import CircleProgressBar from '../../common/CircleProgressBar';
import { RES } from '../../../module/RES';
const Container = FYGE.Container
......@@ -64,8 +61,9 @@ export class GameScene extends MotionInitScene {
gameEle: GameEle
_gIndex: number = 1 // 游戏元素索引
constructor(...args: any){
super(...args)
constructor(){
super()
console.log(123)
}
set gIndex(n: number) {
......@@ -148,6 +146,7 @@ export class GameEle extends Container {
resisteAcc:number = GameCfg.resisteAcc // 摩擦力加速度
k: number // 旋转角度和和中心点距离的系数
isIn: boolean // 是否在中心范围内
lastLen: number // 上一次的距离
fixedCenter: pos // 判断点坐标
finishFunc: Function // success callback
......@@ -182,7 +181,6 @@ export class GameEle extends Container {
}
]
var pos = posList[Math.floor(Math.random() * 3)]
console.log(posList, pos)
this.position.set(pos.x, pos.y)
// this.sprite.scaleX = 0.5
// this.sprite.scaleY = 0.5
......@@ -191,10 +189,8 @@ export class GameEle extends Container {
throw new Error('GameEle need a sprite')
}
var rotation = Math.floor(Math.random() * 361)
var k = this.k = (rotation + 360) / (pos2Len(this.fixedCenter, this) - GameCfg.rc)
var rotation = Math.floor(Math.random() * 181 + 180)
this.k = (rotation) / (pos2Len(this.fixedCenter, this))
}
......@@ -216,8 +212,8 @@ export class GameEle extends Container {
var pos = posList[Math.floor(Math.random() * 3)]
this.position.set(pos.x, pos.y)
var rotation = Math.floor(Math.random() * 361)
this.k = (rotation + 360) / (pos2Len(this.fixedCenter, this) - GameCfg.rc)
var rotation = Math.floor(Math.random() * 181 + 180)
this.k = (rotation) / (pos2Len(this.fixedCenter, this))
}
initEvents() {
......@@ -304,43 +300,15 @@ export class GameEle extends Container {
this.vy = 0
}
var len = pos2Len(this, this.fixedCenter)
if (len >= GameCfg.rc) {
this.setRotation(this.k * (len - GameCfg.rc))
if (this.isIn) {
this.isIn = false
FYGE.Tween.removeTweens(this)
GDispatcher.dispatchEvent('focus-out')
}
} else {
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()
})
}
}
// 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 (len >= GameCfg.rc) {
// this.setRotation(this.k * (len - GameCfg.rc))
// if (this.isIn) {
// this.isIn = false
// FYGE.Tween.removeTweens(this)
// GDispatcher.dispatchEvent('focus-out')
// }
// } else {
// if (!this.isIn) {
// this.isIn = true
// this.vx = 0
......@@ -356,6 +324,35 @@ export class GameEle extends Container {
// })
// }
// }
var len = pos2Len(this, this.fixedCenter)
if (!this.lastLen) this.lastLen = len
if (len <= GameCfg.rc) {
if (len < this.lastLen) {
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()
})
}
} else if (len > this.lastLen && this.isIn) {
this.isIn = false
FYGE.Tween.removeTweens(this)
GDispatcher.dispatchEvent('focus-out')
}
}
this.setRotation(this.k * (len))
this.lastLen = len
}
update() {
......
......@@ -137,6 +137,8 @@ export class MotionInitScene extends Scene {
var bitMapc = Tools.getNumTextures('num')
bitMapc['%'] = RES.getRes('nump.png')
this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc))
this.bitmapTextCount.scaleY = 0.33
this.bitmapTextCount.scaleX = 0.33
this.bitmapTextCount.position.set(layers.stageCenterX, layers.stageCenterY + 380)
......
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