Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zjzy_client_game
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
王勇霞
zjzy_client_game
Commits
a5cb8a39
Commit
a5cb8a39
authored
Mar 27, 2023
by
王勇霞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 跳一跳2.0
parent
aa5932e0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
38 deletions
+26
-38
index.json
mock/webNet/game/index.json
+4
-4
ResJson.ts
src/ResJson.ts
+1
-1
GameScene.ts
src/scenes/GameScene.ts
+10
-14
StartScene.ts
src/scenes/StartScene.ts
+4
-4
Role.ts
src/scenes/components/Role.ts
+7
-15
No files found.
mock/webNet/game/index.json
View file @
a5cb8a39
...
...
@@ -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"
:
fals
e
"ifFirstPlay"
:
tru
e
},
"code"
:
"ipsum est tempor qui"
,
"timestamp"
:
3627649.9094133973
...
...
src/ResJson.ts
View file @
a5cb8a39
...
...
@@ -773,5 +773,5 @@ export const ResJson = {
"name"
:
"svga"
}
],
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/16796
52140
/resource/"
"path"
:
"https://yun.duiba.com.cn/db_games/activity/template/16796
65401
/resource/"
}
\ No newline at end of file
src/scenes/GameScene.ts
View file @
a5cb8a39
...
...
@@ -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
()
// 接口提交
...
...
src/scenes/StartScene.ts
View file @
a5cb8a39
...
...
@@ -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
...
...
src/scenes/components/Role.ts
View file @
a5cb8a39
...
...
@@ -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
});
// 立即设置刚体的线速度。位置、角度、力等不变
})
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment