-
Notifications
You must be signed in to change notification settings - Fork 1
/
Scene1.js
82 lines (70 loc) · 1.9 KB
/
Scene1.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
class Scene1 extends Phaser.Scene {
constructor() {
super("bootGame");
}
preload(){
this.load.image("background", "assets/images/background.png");
this.load.spritesheet("bubble1", "assets/spritesheets/bubble1.png",{
frameWidth: 30,
frameHeight: 28
});
this.load.spritesheet("bubble2", "assets/spritesheets/bubble2.png",{
frameWidth: 30,
frameHeight: 28
});
this.load.spritesheet("bubble3", "assets/spritesheets/bubble3.png",{
frameWidth: 30,
frameHeight: 28
});
this.load.spritesheet("bubble4", "assets/spritesheets/bubble2.png",{
frameWidth: 30,
frameHeight: 28
});
this.load.spritesheet("bubble5", "assets/spritesheets/bubble3.png",{
frameWidth: 30,
frameHeight: 28
});
this.load.spritesheet("player", "assets/spritesheets/player.png",{
frameWidth: 50,
frameHeight: 50
});
}
create() {
//this.count = 0;
this.add.text(20, 20, "Loading game...");
this.scene.start("playGame");
//this.spacebar = this.input.keyboard.addKey(Phaser.Input.Keyboard.SPACE); // Get key object
this.anims.create({
key: "bubble1_anim",
frames: this.anims.generateFrameNumbers("bubble1"),
frameRate: 20,
repeat: -1
});
this.anims.create({
key: "bubble2_anim",
frames: this.anims.generateFrameNumbers("bubble2"),
frameRate: 20,
repeat: -1
});
this.anims.create({
key: "bubble3_anim",
frames: this.anims.generateFrameNumbers("bubble3"),
frameRate: 20,
repeat: -1
});
this.anims.create({
key: "thrust",
frames: this.anims.generateFrameNumbers("player"),
frameRate: 20,
repeat: -1
});
}
/* update () {
this.count += 1;
this.add.text(400, 250," " + this.count);
if (this.spacebar.isDown)
{
this.scene.start("playGame");
}
} */
}