class title extends Phaser.Scene {
constructor() {
super({key: ‘title’});
}
preload() {
var socket = io();
this.load.atlas(“sprites”, “client/img/spritesheet.png”, “client/img/sprites.json”);
this.load.atlas(“explosion”, “client/img/explosionspritesheet.png”, “client/img/explosionsprites.json”);
}
create() {
this.add.image(0, 0, ‘sprites’, “sky”).setOrigin(0, 0);
this.add.image(100, 150, ‘sprites’, “Spaceship1”).rotation = 14.6;
this.add.image(200, 200, ‘sprites’, “Bullet1”).rotation = 14.6;
this.add.image(300, 250, ‘sprites’, “Bullet1”).rotation = 14.6;
this.add.image(400, 300, ‘sprites’, “Bullet1”).rotation = 14.6;
this.add.image(500, 350, ‘explosion’, “explosion5”).rotation = 14.6;
socket.on('acceptedplayer', function() {
this.scene.start("main");
});
}
update() {
}
}