Commit 63a07c35 authored by 邱旭's avatar 邱旭

11.FlppyBird-对象池

parent 7a4ed3fb
...@@ -205,6 +205,9 @@ ...@@ -205,6 +205,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/";
...@@ -226,14 +229,14 @@ ...@@ -226,14 +229,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); // 加在背景和地面的中间
......
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