You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
import { Scene } from "phaser";
|
|
import bg from "@/game/game/assets/flipbird/bg.png";
|
|
|
|
import birdImg from "@/game/game/assets/flipbird/clumsy.png";
|
|
import startBtn from "@/game/game/assets/flipbird/start.png";
|
|
|
|
export default class startScene extends Scene {
|
|
constructor() {
|
|
super({ key: "startFlipBird" });
|
|
}
|
|
|
|
preload() {
|
|
this.load.image("bg", bg);
|
|
this.load.image("startBtn", startBtn);
|
|
this.load.spritesheet("bird", birdImg, {
|
|
frameWidth: 85,
|
|
frameHeight: 60
|
|
});
|
|
}
|
|
|
|
create() {
|
|
this.bg = this.add.image(0, 0, "bg");
|
|
this.startBtn = this.add.image(
|
|
this.game.config.width / 2,
|
|
this.game.config.height / 2 + 100,
|
|
"startBtn"
|
|
);
|
|
this.startBtn.setScale(0.5);
|
|
this.bg.setScale(3.1);
|
|
this.bird = this.physics.add.sprite(
|
|
this.game.config.width / 2,
|
|
this.game.config.height / 2,
|
|
"bird"
|
|
);
|
|
// this.tip = this.add.text(
|
|
// this.game.config.width / 2,
|
|
// this.game.config.height / 2 - 100,
|
|
// "点击屏幕开始游戏",
|
|
// {
|
|
// fontFamily: 'Georgia, "Goudy Bookletter 1911", Times, serif',
|
|
// fontSize: "30px",
|
|
// color: "#000",
|
|
// align: "center"
|
|
// }
|
|
// );
|
|
this.startBtn.setInteractive();
|
|
this.startBtn.on("pointerdown", () =>{
|
|
this.scene.start("flipbird");
|
|
});
|
|
}
|
|
|
|
}
|
|
|