Commit a5cb8a39 authored by 王勇霞's avatar 王勇霞

feat: 跳一跳2.0

parent aa5932e0
......@@ -5,15 +5,15 @@
"dataInfo": [
{
"num": 1,
"context": "闲看晴云自卷舒",
"context": "",
"context1": "闲看晴云自卷舒",
"ifComplete": false,
"count": 74413176.81524068
},
{
"num": 2,
"context": "静水流深",
"context1": "",
"context": "",
"context1": "静水流深",
"ifComplete": false,
"count": 10
},
......@@ -40,7 +40,7 @@
}
],
"collectCount": 1,
"ifFirstPlay": false
"ifFirstPlay": true
},
"code": "ipsum est tempor qui",
"timestamp": 3627649.9094133973
......
......@@ -773,5 +773,5 @@ export const ResJson = {
"name": "svga"
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/template/1679652140/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/template/1679665401/resource/"
}
\ No newline at end of file
......@@ -20,7 +20,6 @@ import { allWords } from "../contant";
import { getUrlParams } from "../../module/web/webTools";
import { GDispatcher } from "../Main";
const testWord:any = ['闲', '看', '晴', '云', '自', '卷', '舒', '静', '水', '流', '深', '心', '无', '意', '在', '休']
export class GameScene extends Scene {
get groupNames() { return ["GameScene"] };
get skinName() { return "GameScene" };
......@@ -41,11 +40,6 @@ export class GameScene extends Scene {
}
async start(data) {
super.start();
// TODO——test
this.wordList = JSON.parse(JSON.stringify(testWord)); // 待随机出现的列表
this.wordLen = this.wordList.length; // 需要收集字体的个数
this.collectList = []
GameScene.instance = this
showPanel(GuidePanel);
......@@ -266,7 +260,7 @@ export class GameScene extends Scene {
// 循环多建几行
for (let i = 0; i < 10; i++) {
if (i == 0) {
this.createLineItem(stageHeight - (260 * (i + 1)), -10, 4, 15);
this.createLineItem(stageHeight - (260 * (i + 1)), 10, 4, 15);
} else {
this.createLineItem(stageHeight - (260 * (i + 1)));
}
......@@ -276,7 +270,6 @@ export class GameScene extends Scene {
createLineItem(h, _sx?: number, _rLen?:number, _space?: number) {
let sx = _sx || Math.floor(Math.random() * 300 - 100); // 初始第一朵云的坐标
let rLen = _rLen || Math.floor(Math.random() * 4 + 2); // 每一行随机出现几朵云
// let rLen = 2
let space = _space || Math.floor(Math.random() * 80); // 增加一点随机间距
const offsetY = this.stage.viewRect.y;
let cloudLi = [];
......@@ -311,7 +304,6 @@ export class GameScene extends Scene {
onFarm() {
// 检测收集的字
if (this.collectList.length >= this.wordLen) {
console.log('this.collectList', this.collectList);
// 游戏结束
this.composites.remove(this.world, this._role.phyBody);
clearTimeout(this.timer);
......@@ -346,10 +338,12 @@ export class GameScene extends Scene {
}
if (this._role.y >= -(this.bgCon.y - 1624)) {
console.log("人物出了舒适圈")
console.log("人物出了舒适圈", this.mapList)
this.isFall = true
this._role.fx = lastItem.x
this._role.fy = lastItem.y
let toItem = this.mapList[0][1]
console.log(lastItem.fx, lastItem.fy)
this._role.fx = lastItem.fx + 60
this._role.fy = lastItem.fy - 200
}
}
......@@ -384,8 +378,10 @@ export class GameScene extends Scene {
}
//游戏结束
async gameOver() {
this._role.jumpSvga.visible = false;
this._role.downSvga.visible = true;
if (this._role) {
this._role.jumpSvga.visible = false;
this._role.downSvga.visible = true;
}
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onFarm, this);
this.removeWorld()
// 接口提交
......
......@@ -86,10 +86,10 @@ export class StartScene extends Scene {
}
async openGame() {
this.btnDelay(this.startbtn)
// if (this.getWordList().length == 0) {
// showToast("您已获取今日全部游戏奖励,\n请明日再来");
// return
// }
if (this.getWordList().length == 0) {
showToast("您已获取今日全部游戏奖励,\n请明日再来");
return
}
const { success, code, data, desc } = await sendWebNet(WebNetName.startGame, {
activityId: getUrlParams('activityId'),
type: 3
......
......@@ -60,18 +60,6 @@ export default class Role extends FYGE.Container {
this.itemImg.addChild(this.lightSvga);
}
die(callback) {
this.jumpSvga.visible = false;
this.downSvga.visible = true;
FYGE.Tween.get(this.downSvga)
.to({
y: this.downSvga.y + 750
}, 1000)
.call(() => {
callback()
})
}
leftMove() {
Matter.Body.applyForce(this.phyBody, this.phyBody.position, {
x: -0.01,
......@@ -107,9 +95,13 @@ export default class Role extends FYGE.Container {
jump() {
setTimeout(() => {
this.jumpSvga.visible = true;
this.downSvga.visible = false;
this.jumpSvga.startAniRange(1, undefined, 1)
if (this.jumpSvga) {
this.jumpSvga.visible = true
this.jumpSvga.startAniRange(1, undefined, 1)
}
if (this.downSvga) {
this.downSvga.visible = false
}
Matter.Body.setVelocity(this.phyBody, { x: 0, y: -8 }); // 立即设置刚体的线速度。位置、角度、力等不变
})
}
......
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