Commit d3a0e112 authored by 邱旭's avatar 邱旭

09.FlppyBird-节点树

parent 40024c90
...@@ -120,6 +120,8 @@ ...@@ -120,6 +120,8 @@
class FlppyBird extends GameStage { class FlppyBird extends GameStage {
bird; bird;
bgMgr;
landMgr;
async preloadRes() { async preloadRes() {
const path = "../images/bird/"; const path = "../images/bird/";
...@@ -141,12 +143,12 @@ ...@@ -141,12 +143,12 @@
// 创建背景 // 创建背景
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, 5); const landMgr = this.landMgr = new ScrollMgr(land1, land2, 5);
this.addChild(bgMgr); this.addChild(bgMgr);
this.addChild(landMgr); this.addChild(landMgr);
......
...@@ -269,6 +269,8 @@ function loadImgAsync(src) { ...@@ -269,6 +269,8 @@ function loadImgAsync(src) {
class FlppyBird extends GameStage { class FlppyBird extends GameStage {
bird; bird;
bgMgr;
landMgr;
async preloadRes() { async preloadRes() {
const path = "../images/bird/"; const path = "../images/bird/";
...@@ -290,12 +292,12 @@ class FlppyBird extends GameStage { ...@@ -290,12 +292,12 @@ 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, 5); const landMgr = this.landMgr = new ScrollMgr(land1, land2, 5);
this.addChild(bgMgr); this.addChild(bgMgr);
this.addChild(landMgr); this.addChild(landMgr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment