-
Notifications
You must be signed in to change notification settings - Fork 33
/
Phasor-Pack-Demo.html
67 lines (52 loc) · 2 KB
/
Phasor-Pack-Demo.html
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
<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>hello phaser!</title>
<script src="phaser.js"></script>
<script src="msgpack.js"></script>
<script src="CreaturePackModule.js"></script>
<script src="CreaturePixiPackJSRenderer.js"></script>
<script src="CreaturePhaserPackRenderer.js"></script>
</head>
<body>
<script type="text/javascript">
window.onload = function() {
var game = new Phaser.Game(800, 600, Phaser.WEBGL, '', { preload: preload, create: create, update: update});
var texture = null;
var creature_pack = null;
function preload () {
game.load.binary('raptorPack', 'raptor_data.creature_pack', binaryLoadCallback, this);
texture = PIXI.Texture.fromImage("raptor_img.png");
}
function binaryLoadCallback(key, data) {
// Convert our binary file into a Uint8Array
// We must return the data value or nothing will be added to the cache, even if you don't modify it.
return new Uint8Array(data);
}
function initDebugging()
{
bmd = game.add.bitmapData(800,600);
sprite = game.add.sprite(0, 0, bmd);
}
function create () {
initDebugging();
creature_pack = new CreaturePackLoader(game.cache.getBinary('raptorPack').buffer);
console.log('Loaded and created Core Creature Objects.');
var creature_renderer = new Phaser.CreaturePackDraw(game.world,
game.world.centerX,
game.world.centerY,
creature_pack,
texture);
creature_renderer.pack_renderer.setActiveAnimation("default");
creature_renderer.scale.set(15.0);
creature_renderer.timeDelta = 1;
game.world.add(creature_renderer);
}
function update() {
// for debugging
}
};
</script>
</body>
</html>