Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
FogNetwork
GitHub Repository: FogNetwork/Tsunami
Path: blob/main/public/games/files/gopher-kart/js/stateTutorial.js
1036 views
1
var StateTutorial = {
2
3
preload: function(){
4
game.load.image("background", "assets/bg-color.png");
5
game.load.spritesheet("controls", "assets/controls-animation.png", 600, 432, 24);
6
game.load.spritesheet("back-button", "assets/back-button.png", 65, 32, 2);
7
game.load.spritesheet("play-button", "assets/play-button.png", 65, 32, 2);
8
game.load.audio("tutorial", "assets/music/tutorialScreenJam-compressed.m4a");
9
10
},
11
12
create: function(){
13
//MUSIC
14
this.tutorialSong = game.add.audio("tutorial");
15
this.tutorialSong.play('', 0, 1, true);
16
this.tutorialSong.volume = 0.5;
17
18
background = game.add.tileSprite(0, 0, 600, 432, "background");
19
20
this.controls = game.add.sprite(game.world.centerX, game.world.height-215, "controls");
21
this.controls.anchor.set(0.5, 0.5);
22
this.controls.animations.add("controls-animation", [], 6, true);
23
this.controls.animations.play("controls-animation");
24
25
//Back Button
26
this.startBtn = game.add.button(40, game.world.height-20,
27
"back-button", this.startMain, this, 1, 0, 1);
28
this.startBtn.anchor.set(0.5, 0.5);
29
30
//Define and add game buttons
31
this.startBtn = game.add.button(563, game.world.height-20,
32
"play-button", this.startGame, this, 1, 0, 1);
33
this.startBtn.anchor.set(0.5, 0.5);
34
},
35
36
startGame: function (){
37
this.tutorialSong.stop();
38
game.state.start("StateChoice");
39
40
},
41
42
startMain: function (){
43
this.tutorialSong.stop();
44
game.state.start("StateTitle");
45
46
},
47
48
update: function(){
49
},
50
51
};
52
53