blob: 945ad147775928d3f9731e6cb1ca82b07501408b (
plain)
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
|
'use strict';
function Preload() {
this.asset = null;
this.ready = false;
}
Preload.prototype = {
preload: function() {
this.asset = this.add.sprite(this.width/2,this.height/2, 'preloader');
this.asset.anchor.setTo(0.5, 0.5);
this.load.onLoadComplete.addOnce(this.onLoadComplete, this);
this.load.setPreloadSprite(this.asset);
this.load.image('wall', 'assets/images/wall.svg');
this.load.image('player-a', 'assets/images/player-a.svg');
this.load.image('player-b', 'assets/images/player-b.svg');
this.load.image('pill', 'assets/images/pill.svg');
},
create: function() {
this.asset.cropEnabled = false;
},
update: function() {
if(!!this.ready) {
this.game.state.start('play');
}
},
onLoadComplete: function() {
this.ready = true;
}
};
module.exports = Preload;
|