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
4d99bc54
Commit
4d99bc54
authored
Jun 20, 2022
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
概率处理完善
parent
b154567c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
23 deletions
+36
-23
rollup.prod.mjs
rollup.prod.mjs
+1
-1
ParkourGameConfig.ts
src/scenes/ParkourGameConfig.ts
+16
-16
ConveyorBelt.ts
src/scenes/comp/ConveyorBelt.ts
+19
-6
No files found.
rollup.prod.mjs
View file @
4d99bc54
...
...
@@ -35,7 +35,7 @@ export default {
progress
(),
BannerVariable
({
values
:
{
__ENV__
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
||
'p
ord
'
),
__ENV__
:
JSON
.
stringify
(
process
.
env
.
NODE_ENV
||
'p
roduction
'
),
__version__
:
JSON
.
stringify
(
version
),
__buildDate__
:
JSON
.
stringify
(
new
Date
()),
}
...
...
src/scenes/ParkourGameConfig.ts
View file @
4d99bc54
...
...
@@ -199,7 +199,7 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
{
uniqueKey
:
'shit'
,
// 这个是障碍物
Container
:
'obstack2.png'
,
ProbabilityPort
:
10
00
,
ProbabilityPort
:
10
,
// anchorX: 130,
// anchorY: 130,
collisionConfig
:
{
...
...
@@ -210,24 +210,24 @@ export const ParkourGameConfig: ParkourGameConfigInfer = {
h
:
50
}
},
//
{
//
uniqueKey: 'protect',
//
Container: 'obstack3.png',
// ProbabilityPort:
0,
//
// anchorX: 100,
//
// anchorY: 100,
//
collisionConfig: {
//
type: 'rect',
//
x: -50,
//
y: 0,
//
w: 100,
//
h: 50
//
}
//
}
{
uniqueKey
:
'protect'
,
Container
:
'obstack3.png'
,
ProbabilityPort
:
1
0
,
// anchorX: 100,
// anchorY: 100,
collisionConfig
:
{
type
:
'rect'
,
x
:
-
50
,
y
:
0
,
w
:
100
,
h
:
50
}
}
],
CommonConfig
:
{
speed
:
300
,
// 速度 可以通过GAME_SPEEDUP 修改
CollisionDebug
:
true
,
// 碰撞检测 debug
CollisionDebug
:
__ENV__
===
'production'
?
false
:
true
,
// 碰撞检测 debug
GamerAxisY
:
1100
,
// 玩家轴Y
GamerIndex
:
1
,
// 当前玩家索引 在哪条道
DetermineXAxis
:
50
,
// 左右滑动判定距离
...
...
src/scenes/comp/ConveyorBelt.ts
View file @
4d99bc54
...
...
@@ -102,7 +102,8 @@ export class ConveyorBeltItem extends FYGE.Container {
type
ProbabilityItemType
=
{
value
:
number
index
:
number
index
:
number
,
ownValuue
:
number
}
/**
...
...
@@ -180,12 +181,14 @@ export class ConveyorBelt extends FYGE.Container {
const
_ParkourGameEleList
=
this
.
ParkourGameEleList
const
sumProbability
=
_ParkourGameEleList
.
reduce
((
prev
,
cur
)
=>
prev
+
cur
.
ProbabilityPort
,
0
)
const
_ProbabilityList
:
ProbabilityItemType
[]
=
[]
_ParkourGameEleList
.
reduce
((
pre
,
curr
,
index
)
=>
{
_ParkourGameEleList
.
reduce
((
pre
,
curr
,
index
,
arr
)
=>
{
const
tp
=
curr
.
ProbabilityPort
/
sumProbability
_ProbabilityList
.
push
({
value
:
pre
+
curr
.
ProbabilityPort
/
sumProbability
,
index
value
:
index
==
arr
.
length
-
1
?
1
:
pre
+
tp
,
index
,
ownValuue
:
tp
})
return
pre
+
curr
.
ProbabilityPort
/
sumProbability
return
pre
+
tp
},
0
)
this
.
ProbabilityList
=
_ProbabilityList
console
.
log
(
'ProbabilityList ==== > '
,
_ProbabilityList
)
...
...
@@ -327,9 +330,19 @@ export class ConveyorBelt extends FYGE.Container {
if
(
this
.
onJudgeNextObstacle
)
{
const
b
=
this
.
onJudgeNextObstacle
(
ParkourGameEle
)
if
(
!
b
)
{
const
skipPortList
=
portList
.
filter
((
item
)
=>
{
const
skipPortList
:
ProbabilityItemType
[]
=
portList
.
filter
((
item
)
=>
{
return
item
.
index
!==
index
})
.
reduce
((
pre
,
cur
,
index
,
arr
)
=>
{
if
(
randomItem
.
ownValuue
===
1
)
return
[]
const
cloneCur
=
{...
cur
}
const
ownValue
=
cloneCur
.
ownValuue
/
(
1
-
randomItem
.
ownValuue
)
cloneCur
.
ownValuue
=
ownValue
cloneCur
.
value
=
index
==
arr
.
length
-
1
?
1
:
((
pre
.
length
==
0
?
0
:
pre
[
pre
.
length
-
1
].
value
)
+
cloneCur
.
ownValuue
)
return
pre
.
concat
(
cloneCur
)
},
[])
console
.
log
(
'skipPortList:'
,
skipPortList
,
randomItem
.
ownValuue
,
randomItem
,
portList
)
// debugger
return
this
.
onGetFinalObstacle
(
skipPortList
)
}
}
...
...
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