Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
DuibaGameTemplate
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
钱根
DuibaGameTemplate
Commits
2c6d0278
Commit
2c6d0278
authored
Jun 16, 2022
by
Master Q
Browse files
Options
Browse Files
Download
Plain Diff
fixed merge
parents
67826fea
e56a7ac2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
ParkourGameConfig.ts
src/scenes/ParkourGameConfig.ts
+7
-5
ParkourGameScene.ts
src/scenes/ParkourGameScene.ts
+12
-8
No files found.
src/scenes/ParkourGameConfig.ts
View file @
2c6d0278
...
...
@@ -53,6 +53,7 @@ interface ParkourGameConfigInfer {
GamerAxisY
:
number
// 玩家轴Y
GamerIndex
:
number
// 默认玩家索引 在哪条 道上
DetermineXAxis
:
number
// 玩家 x 方向判定移动距离
safeDistance
?:
number
// 安全距离
}
}
...
...
@@ -143,7 +144,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
{
uniqueKey
:
'uniqueKey1'
,
Container
:
'obstack1.png'
,
ProbabilityPort
:
10
000
,
ProbabilityPort
:
10
,
collisionConfig
:
{
type
:
'rect'
,
x
:
-
50
,
...
...
@@ -153,9 +154,9 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
}
},
{
uniqueKey
:
'uniqueKey2'
,
uniqueKey
:
'uniqueKey2'
,
// 这个是障碍物
Container
:
'obstack2.png'
,
ProbabilityPort
:
10
,
ProbabilityPort
:
10
0000
,
// anchorX: 130,
// anchorY: 130,
collisionConfig
:
{
...
...
@@ -183,9 +184,10 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
],
CommonConfig
:
{
speed
:
300
,
CollisionDebug
:
fals
e
,
CollisionDebug
:
tru
e
,
GamerAxisY
:
1100
,
GamerIndex
:
1
,
DetermineXAxis
:
50
DetermineXAxis
:
100
,
safeDistance
:
500
}
}
\ No newline at end of file
src/scenes/ParkourGameScene.ts
View file @
2c6d0278
...
...
@@ -80,7 +80,7 @@ export class ParkourScene extends Scene {
this
.
GamerIndex
=
ParkourGameConfig
.
CommonConfig
.
GamerIndex
GDispatcher
.
dispatchEvent
(
ParkourGameEvents
.
GAME_RESTART
)
//
GDispatcher.dispatchEvent(ParkourGameEvents.GAME_RESTART)
}
...
...
@@ -93,13 +93,17 @@ export class ParkourScene extends Scene {
// TODO: 判断下一个障碍物 是否可以出,防止必死的情况
// 就比如下面就比较简单 下一个 item.uniqueKey 为 uniqueKey1 就回去
// 判断全部的传送带是否有 uniqueKey1 并且距离刷新点小于一定距离
// 这样就能 防止必死的情况
if
(
data
.
uniqueKey
===
'uniqueKey1'
)
{
return
this
.
conBeltList
.
filter
(
item
=>
{
return
item
.
children
.
some
((
child
:
ConveyorBeltItem
)
=>
{
return
child
.
y
<
600
&&
child
.
uniqueKey
===
"uniqueKey1"
})
}).
length
<
2
// 这样就能 防止必死的情况'
const
safeNum
=
ParkourGameConfig
.
CommonConfig
.
safeDistance
if
(
safeNum
)
{
if
(
data
.
uniqueKey
===
'uniqueKey2'
)
{
return
this
.
conBeltList
.
filter
(
item
=>
{
return
item
.
children
.
some
((
child
:
ConveyorBeltItem
)
=>
{
return
child
.
y
<
safeNum
&&
child
.
uniqueKey
===
"uniqueKey2"
})
}).
length
<
2
}
return
true
}
return
true
}
...
...
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