|
import Phaser from 'phaser'; |
|
|
|
const config = { |
|
type: Phaser.AUTO, |
|
width: 800, |
|
height: 600, |
|
scene: { |
|
preload: preload, |
|
create: create, |
|
update: update |
|
} |
|
}; |
|
|
|
const game = new Phaser.Game(config); |
|
|
|
let score = 0; |
|
let scoreText; |
|
|
|
function preload() { |
|
|
|
} |
|
|
|
function create() { |
|
|
|
scoreText = this.add.text(16, 16, 'Score: 0', { fontSize: '32px', fill: '#000' }); |
|
} |
|
|
|
function update() { |
|
|
|
scoreText.setText(`Score: ${score}`); |
|
} |
|
|
|
function increaseScore(points) { |
|
score += points; |
|
} |
|
|
|
function displayAchievement(achievement) { |
|
|
|
} |
|
|
|
|
|
|