End.jsimport Phaser from 'phaser';export default class EndScene extends Phaser.Scene { constructor() { super({ key: 'End' }); } preload() { this.input.setDefaultCursor('auto'); } create() { const score = this.registry.get('score') || 0; const bugSpeed = this.registry.get('bugSpeed'); let level = ''; if (bugSpeed === 1500) { leve..
main.jsimport Phaser from 'phaser';export default class MainScene extends Phaser.Scene { constructor() { super({ key: 'Main' }); } preload() { this.load.image('mouse', '../asset/image/mouse1.png'); this.load.image('bug', '../asset/image/bug.png'); this.load.image('ghosts', '../asset/image/ghosts.png'); } create() { this.score = 0; this.tim..
diff.jsimport Phaser from 'phaser';export default class DiffScene extends Phaser.Scene { constructor() { super({ key: 'Diff' }) } create() { this.add.text(this.scale.width / 2, 100, 'Choose Difficulty Level', { fontSize: '48px', fill: '#fff' }).setOrigin(0.5); const level1 = this.add.text(this.scale.width / 2, 200, 'Level 1', { ..
intro.jsimport Phaser from 'phaser';export default class IntroScene extends Phaser.Scene { constructor() { super({ key: 'Intro' }) } create() { this.add.text(this.game.scale.width / 2, 200, 'catching bugs', { fontFamily: 'Arial', fontSize: 80, color: '#87CEFA' }).setOrigin(0.5, 0.5) const textTap = this.add.text(this.g..
index.jsimport Phaser from 'phaser'import IntroScene from './intro.js';import MainScene from './main.js'import EndScene from './End.js';import DiffScene from './diff.js';var game = new Phaser.Game({ type: Phaser.AUTO, parent: 'index', scale: { width: 800, height: 600, autoCenter: Phaser.Scale.Center.CENTER_BOTH }, scene: [ IntroScene, DiffScene, ..
디렉토리 구조우선 내 프로젝트의 최종 디렉토리 구조는 아래와 같다.WEB_GAMEㄴ asset ㄴ audio ㄴ lib ㄴ phaser.min.js ㄴ image ㄴ bug.png ㄴ ghosts.png ㄴ image.png ㄴ mouse1.png ㄴ mouse2.pngㄴ distㄴ node_modulesㄴ src ㄴ index.js ㄴ intro.js ㄴ main.js ㄴ diff.js ㄴ end.jsㄴ index.htmlㄴ package_lock.jsonㄴ package.jsonㄴ webpack.config.js 게임 정하기웹에서 오프라인으로 돌아가는 게임을 만들어보고 싶어서 관련 프레임워크를 알아..