Skip to content

Commit

Permalink
PlayingScene, background 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
choar816 committed May 31, 2022
1 parent 6463519 commit 33f4188
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import LoadingScene from "./scenes/LoadingScene";
import PlayingScene from "./scenes/PlayingScene";
// import MainScene from "./scenes/MainScene";
// import PlayingScene from "./scenes/PlayingScene";
// import GameoverScene from "./scenes/GameoverScene";

const Config = {
// 맵 크기
width: 800,
height: 600,
backgroundColor: 0x000000,
scene: [LoadingScene],
scene: [LoadingScene, PlayingScene],
pixelArt: true,
physics: {
default: "arcade",
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/LoadingScene.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class LoadingScene extends Phaser.Scene {

create() {
this.add.text(20, 20, "Loading game...");
// this.scene.start("mainScene");
this.scene.start("playGame");

this.anims.create({
key: "bat_anim",
Expand Down
34 changes: 34 additions & 0 deletions src/scenes/PlayingScene.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import Phaser from 'phaser';
import Config from "../Config";

export default class PlayingScene extends Phaser.Scene {
constructor() {
super("playGame");
}

create() {
// sound
this.sound.pauseOnBlur = false;
this.m_beamSound = this.sound.add("audio_beam");
this.m_explosionSound = this.sound.add("audio_explosion");
this.m_pickupSound = this.sound.add("audio_pickup");
this.m_hurtSound = this.sound.add("audio_hurt");
this.m_gameoverSound = this.sound.add("audio_gameover");
this.m_pauseInSound = this.sound.add("pause_in");
this.m_pauseOutSound = this.sound.add("pause_out");
this.m_hitEnemySound = this.sound.add("hit_enemy");

// background
this.m_background = this.add.tileSprite(0, 0, Config.width, Config.height, "background");
this.m_background.setOrigin(0, 0);
}


update() {

}


//////////////////////// FUNCTIONS ////////////////////////

}

0 comments on commit 33f4188

Please sign in to comment.