Start Screen
This commit is contained in:
parent
7e1973b74e
commit
a724d80bb7
4 changed files with 48 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Miner</title>
|
||||
<title>SPACE SMASHER 9001!</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import Phaser, { Game } from 'phaser'
|
|||
|
||||
import PlayScene from './scenes/PlayScene'
|
||||
import GameOverScene from './scenes/GameOverScene'
|
||||
import StartScene from './scenes/StartScene'
|
||||
|
||||
const config: Phaser.Types.Core.GameConfig = {
|
||||
type: Phaser.AUTO,
|
||||
|
|
@ -15,7 +16,7 @@ const config: Phaser.Types.Core.GameConfig = {
|
|||
debug: false
|
||||
}
|
||||
},
|
||||
scene: [PlayScene, GameOverScene]
|
||||
scene: [StartScene, PlayScene, GameOverScene]
|
||||
}
|
||||
|
||||
export default new Phaser.Game(config)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export default class PlayScene extends Phaser.Scene {
|
|||
backgroundOrder: number[] = []
|
||||
backgroundId = 0
|
||||
startTimestamp: number = 0
|
||||
auth: any
|
||||
|
||||
constructor() {
|
||||
super('play-scene')
|
||||
|
|
@ -35,7 +36,10 @@ export default class PlayScene extends Phaser.Scene {
|
|||
this.load.multiatlas('asteroids', 'assets/img/asteroids.json', 'assets/img');
|
||||
}
|
||||
|
||||
create() {
|
||||
create(data) {
|
||||
console.log("Started game with", data)
|
||||
this.auth = data
|
||||
|
||||
Asteroid.createAnimations(this)
|
||||
this.difficulty = new DifficultyManager(this)
|
||||
this.events.on('getpoint', this.updateLabel, this)
|
||||
|
|
|
|||
40
src/scenes/StartScene.ts
Normal file
40
src/scenes/StartScene.ts
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import Phaser from 'phaser'
|
||||
|
||||
export default class StartScene extends Phaser.Scene {
|
||||
|
||||
constructor() {
|
||||
super('start-scene')
|
||||
}
|
||||
|
||||
preload() {
|
||||
this.load.image('phaser-logo', 'assets/img/phaser3-logo.png')
|
||||
this.load.image('hs3-logo', 'assets/img/hs3-logo.png')
|
||||
}
|
||||
|
||||
create() {
|
||||
this.add.image(250, 550, 'phaser-logo').setScale(0.5)
|
||||
this.add.image(550, 550, 'hs3-logo').setScale(0.5)
|
||||
|
||||
this.add.text(
|
||||
this.cameras.main.centerX,
|
||||
this.cameras.main.centerY - 100,
|
||||
"SPACE SMASHER 9001!", {
|
||||
font: '64px Verdana',
|
||||
}).setOrigin(0.5, 0.5)
|
||||
|
||||
this.add.text(this.cameras.main.centerX, this.cameras.main.centerY, [
|
||||
"Naciśnij przycisk aby zacząć",
|
||||
"",
|
||||
"Zaloguj się przed rozpoczęciem gry, aby zachować rekord",
|
||||
"albo graj jako gość (bez rankingu)"
|
||||
], {
|
||||
font: '21px Verdana',
|
||||
align: 'center',
|
||||
color: 'cyan'
|
||||
}).setOrigin(0.5, 0.5)
|
||||
|
||||
this.input.on('pointerup', () => {
|
||||
this.scene.start('play-scene', window.myStuff);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue