-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay.js
26 lines (21 loc) · 797 Bytes
/
play.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
'use strict';
function Play() {}
Play.prototype = {
create: function() {
this.game.physics.startSystem(Phaser.Physics.ARCADE);
this.sprite = this.game.add.sprite(this.game.width/2, this.game.height/2, 'yeoman');
this.sprite.inputEnabled = true;
this.game.physics.arcade.enable(this.sprite);
this.sprite.body.collideWorldBounds = true;
this.sprite.body.bounce.setTo(1,1);
this.sprite.body.velocity.x = this.game.rnd.integerInRange(-500,500);
this.sprite.body.velocity.y = this.game.rnd.integerInRange(-500,500);
this.sprite.events.onInputDown.add(this.clickListener, this);
},
update: function() {
},
clickListener: function() {
this.game.state.start('gameover');
}
};
module.exports = Play;