Format code
This commit is contained in:
parent
1ec94c53da
commit
f5696328a6
3 changed files with 21 additions and 22 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<title>Phaser3 + Parceljs Template</title>
|
<head>
|
||||||
</head>
|
<title>Miner</title>
|
||||||
<body>
|
</head>
|
||||||
<script src="main.ts"></script>
|
|
||||||
</body>
|
<body>
|
||||||
|
<script src="main.ts"></script>
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import Phaser from 'phaser'
|
import Phaser from 'phaser'
|
||||||
|
|
||||||
import HelloWorldScene from './scenes/HelloWorldScene'
|
import DefaultScene from './scenes/DefaultScene'
|
||||||
|
|
||||||
const config: Phaser.Types.Core.GameConfig = {
|
const config: Phaser.Types.Core.GameConfig = {
|
||||||
type: Phaser.AUTO,
|
type: Phaser.AUTO,
|
||||||
|
|
@ -12,7 +12,7 @@ const config: Phaser.Types.Core.GameConfig = {
|
||||||
gravity: { y: 200 }
|
gravity: { y: 200 }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scene: [HelloWorldScene]
|
scene: [DefaultScene]
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new Phaser.Game(config)
|
export default new Phaser.Game(config)
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,17 @@
|
||||||
import Phaser from 'phaser'
|
import Phaser from 'phaser'
|
||||||
|
|
||||||
export default class HelloWorldScene extends Phaser.Scene
|
export default class DefaultScene extends Phaser.Scene {
|
||||||
{
|
constructor() {
|
||||||
constructor()
|
super('hello-world')
|
||||||
{
|
|
||||||
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 })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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')
|
this.add.image(400, 300, 'sky')
|
||||||
|
|
||||||
const particles = this.add.particles('particles', 21)
|
const particles = this.add.particles('particles', 21)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue