-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.js
More file actions
34 lines (33 loc) · 752 Bytes
/
game.js
File metadata and controls
34 lines (33 loc) · 752 Bytes
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
const handleCORS = new XMLHttpRequest();
handleCORS.open("GET", "/");
handleCORS.setRequestHeader("Content-Type", "text/html");
const config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: "arcade",
arcade: {
gravity: { y: 200 }
}
},
scene: {
preload: preload,
create: create,
update: update
}
};
const game = new Phaser.Game(config);
function preload() {
this.load.setBaseURL("http://labs.phaser.io");
this.load.image("sky", "assets/sky_purple.png");
this.load.image("ground", "assets/platform.png");
this.load.spritesheet("dude", "assets/dude.png", {
frameWidth: 32,
frameHeight: 48
});
}
function create() {
this.add.image(400, 300, "sky");
}
function update() {}