33 lines
523 B
JavaScript
33 lines
523 B
JavaScript
import Phaser from "phaser";
|
|
import logoImg from "./assets/logo.png";
|
|
|
|
const config = {
|
|
type: Phaser.AUTO,
|
|
parent: "phaser-example",
|
|
width: 800,
|
|
height: 600,
|
|
scene: {
|
|
preload: preload,
|
|
create: create
|
|
}
|
|
};
|
|
|
|
const game = new Phaser.Game(config);
|
|
|
|
function preload() {
|
|
this.load.image("logo", logoImg);
|
|
}
|
|
|
|
function create() {
|
|
const logo = this.add.image(400, 150, "logo");
|
|
|
|
this.tweens.add({
|
|
targets: logo,
|
|
y: 450,
|
|
duration: 2000,
|
|
ease: "Power2",
|
|
yoyo: true,
|
|
loop: -1
|
|
});
|
|
}
|