-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlowrez.js
100 lines (74 loc) · 1.74 KB
/
lowrez.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
window.document.title += ' [pac v' + pac.VERSION + ']';
window.onload = function(){
var ctn = document.getElementById('content');
// get a scale so we occupy 100% height with the game
var gameScale = ctn.clientHeight / 200;
var game = pac.create();
game.use('loader', pac.Loader, {
'MM': 'assets/images/MM.png',
'abstract': 'assets/images/abstract.png',
'nokia-font': {
texture: 'assets/fonts/nokia.png',
definition: 'assets/fonts/nokia.json',
type: 'bitmapFont'
}
});
//game.use('renderer', pac.NativeRenderer, {
game.use('renderer', pac.PixiRenderer, {
container: ctn,
backgroundColor: '#000000',
size: {
width: 320,
height: 200
},
scale: gameScale
});
game.use('input', pac.MouseInput, {
enabled: true,
scale: gameScale
});
game.use('scenes', {
'MM': new MMScene()
});
game.loader.on('complete', function(){
game.start('MM');
});
game.on('update', function(){
var pos = game.inputs.cursor.position;
document.getElementById('pos').innerText = pos.x + ":" + pos.y;
});
game.loader.load();
};
var MMScene = pac.Scene.extend({
texture: 'MM',
size: { width: 320, height: 200 },
init: function(options){
},
onEnter: function(scene){
var abstract = new pac.Sprite({
texture: 'abstract',
position: {
x: 280,
y: 100
},
size: {
width: 32,
height: 32
}
});
var bitmapText = new pac.Text('Ha ha ha!!!', {
font: '7px nokia-font',
position: {
x: 9,
y: 20
},
isBitmapText: true
});
this.addObject(abstract);
this.addObject(bitmapText);
},
onExit: function(scene){
},
update: function(dt){
}
});