-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgender.js
More file actions
33 lines (21 loc) · 758 Bytes
/
gender.js
File metadata and controls
33 lines (21 loc) · 758 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
28
29
30
31
32
33
BasicGame.Gender = function (game) {
};
var leftHalf, righttHalf, isMale;
BasicGame.Gender.prototype = {
create: function () {
this.add.sprite(0, 0, 'gender');
leftHalf = new Phaser.Rectangle(0,0,this.game.width/2,this.game.height/2);
righttHalf = new Phaser.Rectangle(this.game.width/2,0,this.game.width/2,this.game.height/2);
},
update: function () {
if (this.input.activePointer.isDown) {
var insideLeft = leftHalf.contains(this.game.input.mousePointer.x, this.game.input.mousePointer.y);
if (insideLeft){
localStorage.setItem('gender', 'male');
} else {
localStorage.setItem('gender', 'other');
}
this.state.start('Color');
}
},
};