-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathboot.js
86 lines (64 loc) · 2.23 KB
/
boot.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
var BasicGame = {
SEA_SCROLL_SPEED: 12,
PLAYER_SPEED: 300,
ENEMY_MIN_Y_VELOCITY: 30,
ENEMY_MAX_Y_VELOCITY: 60,
SHOOTER_MIN_VELOCITY: 30,
SHOOTER_MAX_VELOCITY: 80,
BOSS_Y_VELOCITY: 15,
BOSS_X_VELOCITY: 200,
BULLET_VELOCITY: 500,
ENEMY_BULLET_VELOCITY: 150,
POWERUP_VELOCITY: 100,
SPAWN_ENEMY_DELAY: Phaser.Timer.SECOND,
SPAWN_SHOOTER_DELAY: Phaser.Timer.SECOND * 3,
SHOT_DELAY: Phaser.Timer.SECOND * 0.1,
SHOOTER_SHOT_DELAY: Phaser.Timer.SECOND * 2,
BOSS_SHOT_DELAY: Phaser.Timer.SECOND,
ENEMY_HEALTH: 5,
SHOOTER_HEALTH: 5,
BOSS_HEALTH: 500,
BULLET_DAMAGE: 1,
CRASH_DAMAGE: 5,
ENEMY_REWARD: 100,
SHOOTER_REWARD: 400,
BOSS_REWARD: 10000,
POWERUP_REWARD: 100,
ENEMY_DROP_RATE: 0.3,
SHOOTER_DROP_RATE: 0.5,
BOSS_DROP_RATE: 0,
PLAYER_EXTRA_LIVES: 3,
PLAYER_GHOST_TIME: Phaser.Timer.SECOND * 3,
INSTRUCTION_EXPIRE: Phaser.Timer.SECOND * 10,
RETURN_MESSAGE_DELAY: Phaser.Timer.SECOND * 2
};
BasicGame.Boot = function (game) {
};
BasicGame.Boot.prototype = {
init: function () {
// Unless you specifically know your game needs to support multi-touch I would recommend setting this to 1
this.input.maxPointers = 1;
// Phaser will automatically pause if the browser tab the game is in loses focus. You can disable that here:
// this.stage.disableVisibilityChange = true;
if (this.game.device.desktop) {
// If you have any desktop specific settings, they can go in here
} else {
// Same goes for mobile settings.
// In this case we're saying "scale the game, no lower than 480x260 and no higher than 1024x768"
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
this.scale.setMinMax(480, 260, 1024, 768);
this.scale.forceLandscape = true;
}
this.scale.pageAlignHorizontally = true;
this.scale.pageAlignVertically = true;
},
preload: function () {
// Here we load the assets required for our preloader (in this case a loading bar)
this.load.image('preloaderBar', 'assets/preloader-bar.png');
},
create: function () {
// By this point the preloader assets have loaded to the cache, we've set the game settings
// So now let's start the real preloader going
this.state.start('Preloader');
}
};