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
16714916
Commit
16714916
authored
Sep 15, 2021
by
Master Q
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0915
parent
a622a43d
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
47 additions
and
670 deletions
+47
-670
Main.ts
src/Main.ts
+3
-3
ResJson.ts
src/ResJson.ts
+7
-646
SoundWeb.ts
src/SoundWeb.ts
+3
-2
BoomEle.ts
src/components/BoomEle.ts
+3
-4
MoonCake.ts
src/components/MoonCake.ts
+14
-0
GameConfig.ts
src/scenes/GameScene/GameConfig.ts
+6
-5
GameScene.ts
src/scenes/GameScene/GameScene.ts
+11
-10
No files found.
src/Main.ts
View file @
16714916
...
@@ -220,9 +220,9 @@ export class Main {
...
@@ -220,9 +220,9 @@ export class Main {
const
pageCfg
=
Tools
.
PAGE
const
pageCfg
=
Tools
.
PAGE
pageCfg
.
gameDiff
&&
Object
.
assign
(
GameSimCfg
,
{
pageCfg
.
gameDiff
&&
Object
.
assign
(
GameSimCfg
,
{
boomProbability
:
3
0
,
// 炸弹的概率
boomProbability
:
1
0
,
// 炸弹的概率
diffLevel
:
6
,
diffLevel
:
10
,
maxBoomNum
:
3
,
// 一波中最多炸弹数
maxBoomNum
:
2
,
// 一波中最多炸弹数
})
})
var
scene
var
scene
if
(
pageCfg
.
newUser
)
{
if
(
pageCfg
.
newUser
)
{
...
...
src/ResJson.ts
View file @
16714916
This diff is collapsed.
Click to expand it.
src/SoundWeb.ts
View file @
16714916
...
@@ -23,8 +23,9 @@ export const Soundurl = {
...
@@ -23,8 +23,9 @@ export const Soundurl = {
sucess
:
'//yun.duiba.com.cn/spark/assets/b8d82c2e432278dcc4fddfec5c6d585ac7cc5675.mp3'
,
sucess
:
'//yun.duiba.com.cn/spark/assets/b8d82c2e432278dcc4fddfec5c6d585ac7cc5675.mp3'
,
fail
:
'//yun.duiba.com.cn/spark/assets/aa8c3daa5c0717d58649b95216bd27e06ee714da.mp3'
,
fail
:
'//yun.duiba.com.cn/spark/assets/aa8c3daa5c0717d58649b95216bd27e06ee714da.mp3'
,
moonCakeOut
:
'//yun.dui88.com/ec747b63-31d2-45ca-ba5a-6b1b8beefec4.mp3'
,
moonCakeOut
:
'//yun.dui88.com/ec747b63-31d2-45ca-ba5a-6b1b8beefec4.mp3'
,
moonCakeBreak
:
'//yun.dui88.com/592006ed-1e80-4770-9ae5-95cdb47dab05.mp3'
,
moonCakeBreak
:
'//yun.dui88.com/ae73ce3d-1c7c-4dec-81d1-c701bace9b8b.mp3'
,
boomBreak
:
'//yun.dui88.com/25f64850-b5d6-4507-b4df-35252282d2e2.mp3'
boomBreak
:
'//yun.dui88.com/25f64850-b5d6-4507-b4df-35252282d2e2.mp3'
,
blade
:
'//yun.dui88.com/6d1b5f49-00ee-4590-975f-e2080f45ec4c.mp3'
,
// 刀光
}
}
// private sounds = {
// private sounds = {
...
...
src/components/BoomEle.ts
View file @
16714916
...
@@ -22,9 +22,6 @@ export default class BoomEle extends FYGE.Sprite {
...
@@ -22,9 +22,6 @@ export default class BoomEle extends FYGE.Sprite {
this
.
anchorX
=
this
.
width
/
2
this
.
anchorX
=
this
.
width
/
2
this
.
reset
()
this
.
reset
()
FYGE
.
Tween
.
get
(
this
,
{
loop
:
true
})
.
to
({
rotation
:
360
},
5000
)
}
}
initPhyBody
()
{
initPhyBody
()
{
...
@@ -43,7 +40,9 @@ export default class BoomEle extends FYGE.Sprite {
...
@@ -43,7 +40,9 @@ export default class BoomEle extends FYGE.Sprite {
reset
()
{
reset
()
{
this
.
isDie
=
false
this
.
isDie
=
false
// this.initPhyBody()
FYGE
.
Tween
.
get
(
this
,
{
loop
:
true
})
.
to
({
rotation
:
360
},
5000
)
return
this
return
this
}
}
...
...
src/components/MoonCake.ts
View file @
16714916
...
@@ -36,10 +36,24 @@ export default class MoonCake extends FYGE.Sprite {
...
@@ -36,10 +36,24 @@ export default class MoonCake extends FYGE.Sprite {
// 克隆一个纹理
// 克隆一个纹理
this
.
texture
=
RES
.
getRes
(
`mooncake
${
i
}
.png`
).
clone
()
this
.
texture
=
RES
.
getRes
(
`mooncake
${
i
}
.png`
).
clone
()
this
.
texture
.
valid
=
true
this
.
texture
.
valid
=
true
// this.anchorTexture.set(0.5, 0.5)
// this.anchorTexture.set(0.5, 0.5)
this
.
anchorY
=
this
.
height
/
2
this
.
anchorY
=
this
.
height
/
2
this
.
anchorX
=
this
.
width
/
2
this
.
anchorX
=
this
.
width
/
2
this
.
scaleX
=
1
this
.
scaleY
=
1
var
_scale
=
{
0
:
1.2
,
1
:
1.55
,
2
:
1.55
}
if
(
_scale
[
i
])
{
this
.
scaleX
=
_scale
[
i
]
this
.
scaleY
=
_scale
[
i
]
}
this
.
initHalfPart
()
this
.
initHalfPart
()
FYGE
.
Tween
.
get
(
this
,
{
loop
:
true
})
FYGE
.
Tween
.
get
(
this
,
{
loop
:
true
})
...
...
src/scenes/GameScene/GameConfig.ts
View file @
16714916
export
const
GameSimCfg
=
{
export
const
GameSimCfg
=
{
boomProbability
:
10
,
// 炸弹的概率
boomProbability
:
5
,
// 炸弹的概率
diffLevel
:
10
,
diffLevel
:
15
,
levelNum
:
4
,
crazyMaxLen
:
6
,
// crazy time boom's number
crazyMaxLen
:
6
,
// crazy time boom's number
maxBoomNum
:
2
,
// 一波中最多炸弹数
maxBoomNum
:
1
,
// 一波中最多炸弹数
shortCutTime
:
2
00
,
shortCutTime
:
5
00
,
crazyTime
:
10000
,
crazyTime
:
10000
,
isPlayMusic
:
fals
e
,
isPlayMusic
:
tru
e
,
GamingTime
:
70000
,
GamingTime
:
70000
,
fpsScale
:
1
fpsScale
:
1
}
}
\ No newline at end of file
src/scenes/GameScene/GameScene.ts
View file @
16714916
...
@@ -21,6 +21,7 @@ export default class GameScene extends Scene {
...
@@ -21,6 +21,7 @@ export default class GameScene extends Scene {
isOver
:
boolean
=
true
isOver
:
boolean
=
true
gameEles
:
Array
<
MoonCake
|
BoomEle
>
=
[]
gameEles
:
Array
<
MoonCake
|
BoomEle
>
=
[]
maxcakes
:
number
=
GameSimCfg
.
diffLevel
maxcakes
:
number
=
GameSimCfg
.
diffLevel
currLevel
:
number
=
0
// 分成n波
sceneContainer
:
FYGE
.
Container
sceneContainer
:
FYGE
.
Container
blade
:
Blade
blade
:
Blade
currBoomNum
:
number
=
0
currBoomNum
:
number
=
0
...
@@ -48,7 +49,6 @@ export default class GameScene extends Scene {
...
@@ -48,7 +49,6 @@ export default class GameScene extends Scene {
shortCutCnt
:
FYGE
.
Container
// 连击 Container
shortCutCnt
:
FYGE
.
Container
// 连击 Container
shortCutText
:
FYGE
.
BitmapText
shortCutText
:
FYGE
.
BitmapText
moonCakeScore
:
number
=
0
moonCakeScore
:
number
=
0
boomScore
:
number
=
0
shortCutScore
:
number
=
0
shortCutScore
:
number
=
0
set
score
(
n
:
number
)
{
set
score
(
n
:
number
)
{
...
@@ -297,7 +297,8 @@ export default class GameScene extends Scene {
...
@@ -297,7 +297,8 @@ export default class GameScene extends Scene {
*/
*/
gennerateMoonCakes
()
{
gennerateMoonCakes
()
{
if
(
this
.
isOver
)
return
if
(
this
.
isOver
)
return
while
(
this
.
gameEles
.
length
<
this
.
maxcakes
)
{
this
.
currLevel
<
GameSimCfg
.
levelNum
&&
++
this
.
currLevel
while
(
this
.
gameEles
.
length
<
Math
.
floor
(
this
.
maxcakes
*
this
.
currLevel
/
GameSimCfg
.
levelNum
))
{
this
.
initGameEle
()
this
.
initGameEle
()
}
}
}
}
...
@@ -314,7 +315,7 @@ export default class GameScene extends Scene {
...
@@ -314,7 +315,7 @@ export default class GameScene extends Scene {
mc
.
addedToPhyScene
(
randomNum
(
1000
,
4000
),
{
x
:
rx
<
812
?
randomNum
(
3
,
5
)
:
randomNum
(
-
3
,
-
5
),
y
:
-
32
*
k
})
mc
.
addedToPhyScene
(
randomNum
(
1000
,
4000
),
{
x
:
rx
<
812
?
randomNum
(
3
,
5
)
:
randomNum
(
-
3
,
-
5
),
y
:
-
32
*
k
})
mc
.
fx
=
rx
mc
.
fx
=
rx
// 测试
// 测试
mc
.
fy
=
75
0
mc
.
fy
=
80
0
this
.
gameEles
.
push
(
mc
)
this
.
gameEles
.
push
(
mc
)
}
}
...
@@ -356,6 +357,7 @@ export default class GameScene extends Scene {
...
@@ -356,6 +357,7 @@ export default class GameScene extends Scene {
return
return
}
}
}
}
this
.
spIcon
.
play
(
1
)
this
.
gameEles
.
forEach
(
ele
=>
{
this
.
gameEles
.
forEach
(
ele
=>
{
!
ele
.
isFire
&&
(
ele
.
fy
=
layers
.
stageHeight
+
1000
)
!
ele
.
isFire
&&
(
ele
.
fy
=
layers
.
stageHeight
+
1000
)
...
@@ -389,7 +391,7 @@ export default class GameScene extends Scene {
...
@@ -389,7 +391,7 @@ export default class GameScene extends Scene {
x
:
layers
.
stageOffsetX
-
200
,
x
:
layers
.
stageOffsetX
-
200
,
y
:
randomNum
(
layers
.
stageOffsetY
+
100
,
layers
.
stageOffsetY
+
300
)
y
:
randomNum
(
layers
.
stageOffsetY
+
100
,
layers
.
stageOffsetY
+
300
)
},
{
},
{
x
:
randomNum
(
15
,
2
0
),
x
:
randomNum
(
20
,
3
0
),
y
:
randomNum
(
-
4
,
-
10
)
y
:
randomNum
(
-
4
,
-
10
)
}))
}))
}
}
...
@@ -399,7 +401,7 @@ export default class GameScene extends Scene {
...
@@ -399,7 +401,7 @@ export default class GameScene extends Scene {
x
:
layers
.
stageOffsetX
+
layers
.
stageWidth
+
50
,
x
:
layers
.
stageOffsetX
+
layers
.
stageWidth
+
50
,
y
:
randomNum
(
layers
.
stageOffsetY
+
100
,
layers
.
stageOffsetY
+
300
)
y
:
randomNum
(
layers
.
stageOffsetY
+
100
,
layers
.
stageOffsetY
+
300
)
},
{
},
{
x
:
randomNum
(
-
15
,
-
2
0
),
x
:
randomNum
(
-
20
,
-
3
0
),
y
:
randomNum
(
-
4
,
-
10
)
y
:
randomNum
(
-
4
,
-
10
)
}))
}))
}
}
...
@@ -417,7 +419,6 @@ export default class GameScene extends Scene {
...
@@ -417,7 +419,6 @@ export default class GameScene extends Scene {
boomScoreSp
:
FYGE
.
Sprite
boomScoreSp
:
FYGE
.
Sprite
onBoomFunc
({
data
})
{
onBoomFunc
({
data
})
{
this
.
score
-=
10
this
.
score
-=
10
this
.
boomScore
-=
10
// 重新计算连击
// 重新计算连击
this
.
shortCutNum
.
reDo
()
this
.
shortCutNum
.
reDo
()
this
.
allGameEles
.
forEach
((
ele
,
i
)
=>
{
this
.
allGameEles
.
forEach
((
ele
,
i
)
=>
{
...
@@ -563,7 +564,7 @@ export default class GameScene extends Scene {
...
@@ -563,7 +564,7 @@ export default class GameScene extends Scene {
}
}
drawBlade
=
throttle
((
e
)
=>
{
drawBlade
=
throttle
((
e
)
=>
{
!
this
.
isOver
&&
this
.
blade
&&
this
.
blade
.
drawBlade
(
e
)
(
!
this
.
isOver
||
this
.
isCrazy
)
&&
this
.
blade
&&
this
.
blade
.
drawBlade
(
e
)
},
0
)
},
0
)
// 帧事件
// 帧事件
...
@@ -571,7 +572,7 @@ export default class GameScene extends Scene {
...
@@ -571,7 +572,7 @@ export default class GameScene extends Scene {
let
len
=
this
.
gameEles
.
length
let
len
=
this
.
gameEles
.
length
for
(
var
i
=
len
-
1
;
i
>=
0
;
i
--
)
{
for
(
var
i
=
len
-
1
;
i
>=
0
;
i
--
)
{
var
curr
=
this
.
gameEles
[
i
]
var
curr
=
this
.
gameEles
[
i
]
if
(
curr
.
y
>
layers
.
stageHeight
)
{
if
(
curr
.
y
>
layers
.
stageHeight
+
100
)
{
curr
.
comeDown
()
curr
.
comeDown
()
if
(
curr
instanceof
MoonCake
)
{
if
(
curr
instanceof
MoonCake
)
{
// @ts-ignore
// @ts-ignore
...
@@ -593,7 +594,7 @@ export default class GameScene extends Scene {
...
@@ -593,7 +594,7 @@ export default class GameScene extends Scene {
let
llen
=
this
.
leftCrazyMoonCake
.
length
let
llen
=
this
.
leftCrazyMoonCake
.
length
for
(
let
i
=
llen
-
1
;
i
>=
0
;
i
--
)
{
for
(
let
i
=
llen
-
1
;
i
>=
0
;
i
--
)
{
let
curr
=
this
.
leftCrazyMoonCake
[
i
]
let
curr
=
this
.
leftCrazyMoonCake
[
i
]
if
(
curr
.
y
>
layers
.
stageHeight
)
{
if
(
curr
.
y
>
layers
.
stageHeight
+
100
)
{
curr
.
comeDown
()
curr
.
comeDown
()
if
(
curr
instanceof
MoonCake
)
{
if
(
curr
instanceof
MoonCake
)
{
// @ts-ignore
// @ts-ignore
...
@@ -608,7 +609,7 @@ export default class GameScene extends Scene {
...
@@ -608,7 +609,7 @@ export default class GameScene extends Scene {
let
rlen
=
this
.
rightCrazyMoonCake
.
length
let
rlen
=
this
.
rightCrazyMoonCake
.
length
for
(
let
i
=
rlen
-
1
;
i
>=
0
;
i
--
)
{
for
(
let
i
=
rlen
-
1
;
i
>=
0
;
i
--
)
{
let
curr
=
this
.
rightCrazyMoonCake
[
i
]
let
curr
=
this
.
rightCrazyMoonCake
[
i
]
if
(
curr
.
y
>
layers
.
stageHeight
)
{
if
(
curr
.
y
>
layers
.
stageHeight
+
100
)
{
curr
.
comeDown
()
curr
.
comeDown
()
if
(
curr
instanceof
MoonCake
)
{
if
(
curr
instanceof
MoonCake
)
{
// @ts-ignore
// @ts-ignore
...
...
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