Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game2048
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
熊东起
game2048
Commits
6d083fc9
Commit
6d083fc9
authored
Apr 24, 2020
by
huangwenjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
5fd30067
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
PlayScene.ts
src/scenes/playScene/PlayScene.ts
+9
-1
No files found.
src/scenes/playScene/PlayScene.ts
View file @
6d083fc9
...
...
@@ -602,6 +602,10 @@ export class PlayScene extends Scene {
this
.
bombBtn
.
mouseEnable
=
true
this
.
bombing
=
false
this
.
removeChild
(
showImage
)
if
(
this
.
checkAllZero
())
{
// 只有0
this
.
generateOneElement
()
}
},
300
);
},
PropType
.
boom
)
...
...
@@ -703,6 +707,10 @@ export class PlayScene extends Scene {
this
.
removeAnis
()
// if (!this.isGameWin())
this
.
isGameOver
()
if
(
this
.
checkAllZero
())
{
// 只有0
this
.
generateOneElement
()
}
},
300
);
},
PropType
.
net
)
},
this
)
...
...
@@ -934,7 +942,7 @@ export class PlayScene extends Scene {
// 随机生成基础元素
generateOneElement
()
{
// 随机生成一个数字 2or4
let
randNumber
=
Math
.
random
()
<
0.
5
?
2
:
2048
let
randNumber
=
Math
.
random
()
<
0.
9
?
2
:
4
// 随机生成位置
let
randNumberX
=
Math
.
floor
(
Math
.
random
()
*
4
)
let
randNumberY
=
Math
.
floor
(
Math
.
random
()
*
4
)
...
...
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