Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
game-stydy
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
谌继荃
game-stydy
Commits
7a4ed3fb
Commit
7a4ed3fb
authored
Mar 11, 2021
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
10.FlppyBird-创建障碍
parent
d3a0e112
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
10.FlppyBird-创建障碍.html
10.FlppyBird-创建障碍/10.FlppyBird-创建障碍.html
+6
-3
10.FlppyBird-创建障碍.md
10.FlppyBird-创建障碍/10.FlppyBird-创建障碍.md
+5
-3
No files found.
10.FlppyBird-创建障碍/10.FlppyBird-创建障碍.html
View file @
7a4ed3fb
...
@@ -198,6 +198,9 @@
...
@@ -198,6 +198,9 @@
class
FlppyBird
extends
GameStage
{
class
FlppyBird
extends
GameStage
{
bird
;
bird
;
bgMgr
;
landMgr
;
pieMgr
;
async
preloadRes
()
{
async
preloadRes
()
{
const
path
=
"../images/bird/"
;
const
path
=
"../images/bird/"
;
...
@@ -219,14 +222,14 @@
...
@@ -219,14 +222,14 @@
// 创建背景
// 创建背景
const
bg1
=
new
Sprite
(
"../images/bird/background.png"
);
const
bg1
=
new
Sprite
(
"../images/bird/background.png"
);
const
bg2
=
new
Sprite
(
"../images/bird/background.png"
);
const
bg2
=
new
Sprite
(
"../images/bird/background.png"
);
const
bgMgr
=
new
ScrollMgr
(
bg1
,
bg2
,
2
);
const
bgMgr
=
this
.
bgMgr
=
new
ScrollMgr
(
bg1
,
bg2
,
2
);
// 创建地面
// 创建地面
const
land1
=
new
Sprite
(
"../images/bird/land.png"
);
const
land1
=
new
Sprite
(
"../images/bird/land.png"
);
const
land2
=
new
Sprite
(
"../images/bird/land.png"
);
const
land2
=
new
Sprite
(
"../images/bird/land.png"
);
const
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
4
);
const
landMgr
=
this
.
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
4
);
const
pieMgr
=
new
PieMgr
(
4
,
1000
);
// 创建PieMgr
const
pieMgr
=
this
.
pieMgr
=
new
PieMgr
(
4
,
1000
);
// 创建PieMgr
this
.
addChild
(
bgMgr
);
this
.
addChild
(
bgMgr
);
this
.
addChild
(
pieMgr
);
// 加在背景和地面的中间
this
.
addChild
(
pieMgr
);
// 加在背景和地面的中间
...
...
10.FlppyBird-创建障碍/10.FlppyBird-创建障碍.md
View file @
7a4ed3fb
...
@@ -107,6 +107,8 @@ class PieMgr extends GameObject {
...
@@ -107,6 +107,8 @@ class PieMgr extends GameObject {
```
javascript
```
javascript
class
FlppyBird
extends
GameStage
{
class
FlppyBird
extends
GameStage
{
pieMgr
;
/* ... */
/* ... */
...
@@ -115,14 +117,14 @@ class FlppyBird extends GameStage {
...
@@ -115,14 +117,14 @@ class FlppyBird extends GameStage {
// 创建背景
// 创建背景
const
bg1
=
new
Sprite
(
"../images/bird/background.png"
);
const
bg1
=
new
Sprite
(
"../images/bird/background.png"
);
const
bg2
=
new
Sprite
(
"../images/bird/background.png"
);
const
bg2
=
new
Sprite
(
"../images/bird/background.png"
);
const
bgMgr
=
new
ScrollMgr
(
bg1
,
bg2
,
2
);
const
bgMgr
=
this
.
bgMgr
=
new
ScrollMgr
(
bg1
,
bg2
,
2
);
// 创建地面
// 创建地面
const
land1
=
new
Sprite
(
"../images/bird/land.png"
);
const
land1
=
new
Sprite
(
"../images/bird/land.png"
);
const
land2
=
new
Sprite
(
"../images/bird/land.png"
);
const
land2
=
new
Sprite
(
"../images/bird/land.png"
);
const
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
4
);
const
landMgr
=
this
.
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
4
);
const
pieMgr
=
new
PieMgr
(
4
,
1000
);
// 创建PieMgr
const
pieMgr
=
this
.
pieMgr
=
new
PieMgr
(
4
,
1000
);
// 创建PieMgr
this
.
addChild
(
bgMgr
);
this
.
addChild
(
bgMgr
);
this
.
addChild
(
pieMgr
);
// 加在背景和地面的中间
this
.
addChild
(
pieMgr
);
// 加在背景和地面的中间
...
...
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