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
d3a0e112
Commit
d3a0e112
authored
Mar 11, 2021
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
09.FlppyBird-节点树
parent
40024c90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
09.FlppyBird-节点树.html
09.FlppyBird-节点树/09.FlppyBird-节点树.html
+14
-12
09.FlppyBird-节点树.md
09.FlppyBird-节点树/09.FlppyBird-节点树.md
+4
-2
No files found.
09.FlppyBird-节点树/09.FlppyBird-节点树.html
View file @
d3a0e112
...
...
@@ -117,19 +117,21 @@
/**
* FlppyBird
*/
class
FlppyBird
extends
GameStage
{
class
FlppyBird
extends
GameStage
{
bird
;
bird
;
bgMgr
;
landMgr
;
async
preloadRes
()
{
const
path
=
"../images/bird/"
;
async
preloadRes
()
{
const
path
=
"../images/bird/"
;
const
promises
=
[
"bird_01.png"
,
"bird_02.png"
,
"bird_03.png"
,
"pie.png"
,
"land.png"
,
"background.png"
,
"start_button.png"
].
map
((
v
)
=>
{
return
loadImgAsync
(
`
${
path
}${
v
}
`
);
});
const
promises
=
[
"bird_01.png"
,
"bird_02.png"
,
"bird_03.png"
,
"pie.png"
,
"land.png"
,
"background.png"
,
"start_button.png"
].
map
((
v
)
=>
{
return
loadImgAsync
(
`
${
path
}${
v
}
`
);
});
return
Promise
.
all
(
promises
);
}
...
...
@@ -141,12 +143,12 @@
// 创建背景
const
bg1
=
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
land2
=
new
Sprite
(
"../images/bird/land.png"
);
const
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
5
);
const
landMgr
=
this
.
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
5
);
this
.
addChild
(
bgMgr
);
this
.
addChild
(
landMgr
);
...
...
09.FlppyBird-节点树/09.FlppyBird-节点树.md
View file @
d3a0e112
...
...
@@ -269,6 +269,8 @@ function loadImgAsync(src) {
class
FlppyBird
extends
GameStage
{
bird
;
bgMgr
;
landMgr
;
async
preloadRes
()
{
const
path
=
"../images/bird/"
;
...
...
@@ -290,12 +292,12 @@ class FlppyBird extends GameStage {
// 创建背景
const
bg1
=
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
land2
=
new
Sprite
(
"../images/bird/land.png"
);
const
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
5
);
const
landMgr
=
this
.
landMgr
=
new
ScrollMgr
(
land1
,
land2
,
5
);
this
.
addChild
(
bgMgr
);
this
.
addChild
(
landMgr
);
...
...
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