Format code

This commit is contained in:
KGrzeg 2021-10-12 16:07:59 +02:00
parent 1ec94c53da
commit f5696328a6
3 changed files with 21 additions and 22 deletions

View file

@ -1,8 +1,11 @@
<html>
<head>
<title>Phaser3 + Parceljs Template</title>
</head>
<body>
<script src="main.ts"></script>
</body>
<head>
<title>Miner</title>
</head>
<body>
<script src="main.ts"></script>
</body>
</html>

View file

@ -1,6 +1,6 @@
import Phaser from 'phaser'
import HelloWorldScene from './scenes/HelloWorldScene'
import DefaultScene from './scenes/DefaultScene'
const config: Phaser.Types.Core.GameConfig = {
type: Phaser.AUTO,
@ -12,7 +12,7 @@ const config: Phaser.Types.Core.GameConfig = {
gravity: { y: 200 }
}
},
scene: [HelloWorldScene]
scene: [DefaultScene]
}
export default new Phaser.Game(config)

View file

@ -1,21 +1,17 @@
import Phaser from 'phaser'
export default class HelloWorldScene extends Phaser.Scene
{
constructor()
{
super('hello-world')
}
preload()
{
this.load.image('sky', 'assets/img/nebula10.png')
this.load.image('logo', 'assets/img/phaser3-logo.png')
this.load.spritesheet('particles', 'assets/img/boom.png', { frameWidth: 960/5, frameHeight: 1344/7 })
export default class DefaultScene extends Phaser.Scene {
constructor() {
super('hello-world')
}
create()
{
preload() {
this.load.image('sky', 'assets/img/nebula10.png')
this.load.image('logo', 'assets/img/phaser3-logo.png')
this.load.spritesheet('particles', 'assets/img/boom.png', { frameWidth: 192, frameHeight: 192 })
}
create() {
this.add.image(400, 300, 'sky')
const particles = this.add.particles('particles', 21)