-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathui_initial.js
More file actions
27 lines (23 loc) · 817 Bytes
/
ui_initial.js
File metadata and controls
27 lines (23 loc) · 817 Bytes
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
pc.script.create('ui_initial', function (context) {
var Ui_initial = function (entity) {
this.entity = entity;
};
Ui_initial.prototype = {
initialize: function () {
this.playButton = this.entity.findByName('SpritePlay').script.sprite;
this.playButton.on('click', this.onPlayClicked, this);
this.game = context.root.findByName('Game').script.game;
},
onPlayClicked: function () {
this.game.audio.playClickSound();
this.game.startGame();
},
update: function (dt) {
if (context.keyboard.wasPressed(pc.input.KEY_SPACE) ||
context.keyboard.wasPressed(pc.input.KEY_RETURN)) {
this.onPlayClicked();
}
}
};
return Ui_initial;
});