-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial.js
More file actions
122 lines (119 loc) · 4.08 KB
/
tutorial.js
File metadata and controls
122 lines (119 loc) · 4.08 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
Vue.component("main_tutorial", {
template: `
<div>
<div class="modalbg"
@click="exittutorial()">
</div>
<div class="modal"
>
<div style="width:0px;heigth:0px;overflow:hidden;position:absolute">
<img v-for="n in tmp.tutorial.images" :src=tmp.tutorial.images[n-1]>
</div>
<table>
<tr>
<td colspan=3>
<h1 class="modaltitle">{{tmp.tutorial.title}}</h1>
</td>
</tr>
<tr>
<td colspan=3>
<img class="modalimg"
:src=tmp.tutorial.images[tmp.tutorial.stage]>
</td>
</tr>
<tr>
<td class="modalbtn">
<button v-if="tmp.tutorial.stage!==0"
@click=tmp.tutorial.stage--
><span>←</span></button>
</td>
<td class="modaltxt">
<span>{{tmp.tutorial.text[tmp.tutorial.stage]}}</span>
</td>
<td class="modalbtn">
<button v-if="tmp.tutorial.stage < tmp.tutorial.images.length-1"
@click=tmp.tutorial.stage++
><span>→</span></button>
<button v-else
@click=exittutorial()
><span>✔</span></button>
</td>
</tr>
</table>
</div>
</div>
`,
});
Vue.component("tutorials_tab", {
template: `
<div id="tutortab">
<button @click="tmp.page=2" style="position:absolute; width:100px;height: 40px;margin: 0px;">Exit</button>
<button @click="startTutorial(true, 1)"><h2>Basics</h2></button>
<button @click="startTutorial(true, 4)" v-if="player.tutorial[3]"><h2>Portals</h2></button>
<button @click="startTutorial(true, 2)" v-if="player.tutorial[1]"><h2>Storage block</h2></button>
<button @click="startTutorial(true, 3)" v-if="player.tutorial[2]"><h2>Infinite loop and white</h2></button>
</div>
`,
});
function startTutorial(forced=false, type=0, end=false){
if (end){
tmp.tutorial.type=5
tmp.tutorial.title="You Won!"
tmp.tutorial.images=["./images/tutorials/thanks.jpg"]
tmp.tutorial.text=[
""]
tmp.tutorial.stage=0
tmp.modalvisible=true
}
//basic tutorial on lvl 1-1
else if ((tmp.level===1||type===1)&&(!player.tutorial[0]||forced===true)){
tmp.tutorial.type=1
tmp.tutorial.title="Basics"
tmp.tutorial.images=["./images/tutorials/1-1.png","./images/tutorials/1-2.png"]
tmp.tutorial.text=[
"Blocks with triangles output laser",
"push boxes to connect one of the lasers with the sun"]
tmp.tutorial.stage=0
tmp.modalvisible=true
}
//store block explanation on lvl 3-9
else if ((tmp.level===33||type===2)&&(!player.tutorial[1]||forced===true)){
tmp.tutorial.type=2
tmp.tutorial.title="Storage block"
tmp.tutorial.images=["./images/tutorials/2-1.png","./images/tutorials/2-2.png","./images/tutorials/2-3.png"]
tmp.tutorial.text=[
"Storage keeps the first color it interacted with",
"Storage keeps the first color it interacted with",
"It will not be not overwritten by other colors and it can be used to mix them"]
tmp.tutorial.stage=0
tmp.modalvisible=true
}
//loop explanation on lvl 5-7
else if ((tmp.level===55||type===3)&&(!player.tutorial[2]||forced===true)){
tmp.tutorial.type=3
tmp.tutorial.title="Infinite loop and white"
tmp.tutorial.images=["./images/tutorials/3-1.png","./images/tutorials/3-2.png"]
tmp.tutorial.text=[
"When lasers are cycled, infinite loop occurs and the color of the lasers will become white.",
"Storage will reset its color when it touches white."]
tmp.tutorial.stage=0
tmp.modalvisible=true
}
else if ((tmp.level===13||type===4)&&(!player.tutorial[3]||forced===true)){
tmp.tutorial.type=4
tmp.tutorial.title="Portals"
tmp.tutorial.images=["./images/tutorials/4-1.png"]
if(player.k)tmp.tutorial.text=["Tap on the portal to see where it leads to"]
else tmp.tutorial.text=["Hover over the portal to see where it leads to"]
tmp.tutorial.stage=0
tmp.modalvisible=true
}
}
function exittutorial(){
tmp.modalvisible=false
player.tutorial[tmp.tutorial.type-1]=true
tmp.tutorial.images=[]
tmp.tutorial.text=[]
tmp.tutorial.stage=0
tmp.tutorial.type=0
}