-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimilar_functions.js
More file actions
156 lines (147 loc) · 5.73 KB
/
Copy pathsimilar_functions.js
File metadata and controls
156 lines (147 loc) · 5.73 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
function right_vision()
{
for (let i = 0; i < watch_width_wall.length; i++)
{
if ((unit[0].object_x > watch_width_wall[i].object_x) && (watch_width_wall[i].visited))
{
window.scrollTo({
left: screen_w / 20 * 10 * (i + 1) ,
behavior: "smooth"
});
global_click_x = screen_w / 20 * 10 * (i + 1) + 1;
watch_width_wall[i].visited = false;
}
}
}
function left_vision()
{
for (let i = 0; i < watch_width_wall.length; i++)
{
if ((unit[0].object_x < watch_width_wall[i].object_x) && (!watch_width_wall[i].visited))
{
window.scrollTo({
left: screen_w / 20 * 10 * i,
behavior: "smooth"
});
global_click_x = screen_w / 20 * 10 * i;
watch_width_wall[i].visited = true;
}
}
}
function down_vision()
{
for (let i = 0; i < watch_height_wall.length; i++)
{
if ((unit[0].object_y > watch_height_wall[i].object_y) && (watch_height_wall[i].visited))
{
window.scrollTo({
top: screen_h / 20 * 10 * (i + 1) ,
behavior: "smooth"
});
global_click_y = screen_h / 20 * 10 * (i + 1) + 1;
watch_height_wall[i].visited = false;
}
}
}
function up_vision()
{
for (let i = 0; i < watch_height_wall.length; i++)
{
if ((unit[0].object_y < watch_height_wall[i].object_y) && (!watch_height_wall[i].visited))
{
window.scrollTo({
top: screen_h / 20 * 10 * i ,
behavior: "smooth"
});
global_click_y = screen_h / 20 * 10 * i;
watch_height_wall[i].visited = true;
}
}
}
function check_HP_MP()
{
if (unit[0].mp < 0.074) unit[0].mp +=0.0003;
if (unit[0].mp > 0.074) unit[0].mp = 0.074;
for (let i = 0; i < unit.length; i++) {if (unit[i].hp < 0.074) unit[i].hp +=0.0001;}
}
function check_keys()
{
for (let i = 0; i < point_key.length;)
{
let a = Math.pow(Math.pow(unit[0].object_x - point_key[i].x - point_key[i].pos_x, 2) + Math.pow(unit[0].object_y - point_key[i].y - point_key[i].pos_y, 2), 1/2);
let c = Math.pow(Math.pow(unit[0].object_x - point_key[i].x - point_key[i].pos_x, 2) + Math.pow(unit[0].object_y + unit[0].target_y - point_key[i].y - point_key[i].pos_y, 2), 1/2);
let b = unit[0].radius + point_key[i].radius;
if ((b > a) || (b > c))
{
sound_key();
point_key.splice(i, 1);
walls_bot.splice(walls_bot.length - 1, 1);
walls_top.splice(walls_top.length - 1, 1);
}
else i++;
}
}
function monstr_inside(i)
{
/*let a = Math.pow(Math.pow(Math.abs(unit[0].object_x - unit[i].object_x), 2) + Math.pow(Math.abs(unit[0].object_y - unit[i].object_y), 2), 1/2);//head and head
let b = Math.pow(Math.pow(Math.abs(unit[0].object_x - unit[i].object_x), 2) + Math.pow(Math.abs((unit[0].object_y + unit[0].target_y) - (unit[i].object_y + unit[i].target_y)), 2), 1/2);//body and body
let c = Math.pow(Math.pow(Math.abs(unit[0].object_x - unit[i].object_x), 2) + Math.pow(Math.abs((unit[0].object_y + unit[0].target_y) - unit[i].object_y), 2), 1/2);//hero body and monstr head
let d = Math.pow(Math.pow(Math.abs(unit[0].object_x - unit[i].object_x), 2) + Math.pow(Math.abs(unit[0].object_y - (unit[i].object_y + unit[i].target_y)), 2), 1/2);//monstr body and hero head
let r = unit[0].radius + unit[i].radius;
if ((d < r)||(a < r)||(b < r)||(c < r)) return false;
else return true;*/
return true;
}
/*function show_hide()
{
let doc=document.getElementById('gule_img');
if(doc.style.display == "none") doc.style.display = "block";
else doc.style.display = "none"
alert('ты че');
}*/
let kill_gule = 0;
let ghost_kill = 0;
let chest_found = 0;
let level = 1;
let kol_gule = 6;
let all_gule_kills = 0;
let all_ghost_kills = 0;
function finish()
{
//clearInterval('move()');
all_gule_kills += kill_gule;
window.scrollTo(0, screen_h * 2);
document.getElementById('gule').innerHTML = kill_gule + '/' + kol_gule;
document.getElementById('chest').innerHTML = '1/1';
document.getElementById('chest_all').innerHTML = chest_found + '/3';
document.getElementById('gule_all').innerHTML = all_gule_kills + '/18';
if (level == 2)
{
all_ghost_kills += ghost_kill;
document.getElementById("ghost_name").innerHTML = "призрак";
document.getElementById("ghost_img").style.display = 'block';
document.getElementById("ghost").innerHTML = ghost_kill + '/2';
document.getElementById("ghost_all").innerHTML = all_ghost_kills + '/6';
}
if (level == 3)
{
document.getElementById('continue').innerHTML = ' ';
document.getElementById('level').style.display = 'none';
document.getElementById('result').innerHTML = 'игра пройдена'
document.getElementById('message').innerHTML = 'ждите появление босса'
}
if (chest_found != level)
{
document.getElementById('result').innerHTML = 'поражение'
document.getElementById('message').innerHTML = 'вы не смогли найти клад :с'
document.getElementById('level').innerHTML = 'новая игра'
document.getElementById('continue').innerHTML = ' ';
clearInterval(idTimer);
}
else
{
document.getElementById('result').innerHTML = 'уровень ' + level + ' пройден!'
level += 1;
document.getElementById('level').innerHTML = 'уровень ' + level;
}
}