forked from Ceth2001/Towerman
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Tower_Man.js
42 lines (34 loc) · 1.26 KB
/
Tower_Man.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
// 1. Wait for the onload event
window.addEventListener("load",function() {
// 2. Set up a basic Quintus object
// with the necessary modules and controls
// to make things easy, we're going to fix this game at 640x480
var Q = window.Q = Quintus({ development: true,
imagePath: "http://www.corsproxy.com/html5gametutorial.com/tower_man/images/",
audioPath: "http://www.corsproxy.com/html5gametutorial.com/tower_man/assets/",
dataPath: "http://www.corsproxy.com/html5gametutorial.com/tower_man/data/"
}).include("Sprites, Scenes, Input, 2D")
.setup({ width: 640, height: 480 });
// 3. Add in the default keyboard controls
// along with joypad controls for touch
Q.input.keyboardControls();
Q.input.joypadControls();
// 4. Add in a basic sprite to get started
Q.Sprite.extend("Player", {
init: function(p) {
this._super(p,{
sheet:"player"
});
this.add("2d");
}
});
// 5. Put together a minimal level
Q.scene("level1",function(stage) {
var player = stage.insert(new Q.Player({ x: 48, y: 48 }));
});
// 6. Load and start the level
Q.load("sprites.png, sprites.json, level.json", function() {
Q.compileSheets("sprites.png","sprites.json");
Q.stageScene("level1");
});
});