-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheats.js
executable file
·72 lines (66 loc) · 2.24 KB
/
cheats.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
var cheatsVisible = false
var cheatSelected = 0
var wallcheat = false
var trailcheat = false
var applecheat = false
var bot = false
function renderCheatsMenu() {
ctx.fillStyle = "#0f0"
ctx.fillRect(20,20,600,600)
ctx.clearRect(26,26,590,590)
ctx.font = "40px monospace"
centerText("CHEATS MENU",60)
ctx.font = "30px monospace"
ctx.fillText((wallcheat ? "* " : " ") + "Wallcheat", 60,100)
ctx.fillText((trailcheat ? "* " : " ") + "Trailcheat", 60,130)
ctx.fillText((applecheat ? "* " : " ") + "Applecheat", 60,160)
ctx.fillText((bot ? "* " : " ") + "Bot", 60,190)
ctx.fillStyle = colorPalettes[colorPalette].head
ctx.fillText("Color Palette: " + colorPalette, 60,220)
ctx.fillStyle = "#0f0"
ctx.fillText("Go back", 60,280)
ctx.fillText(">",34,((cheatSelected == 5 ? 6 : cheatSelected) * 30) + 100)
}
function checkCheats(key) {
if ((keylog.endsWith("c")) && !cheatsVisible) {
cancelAnimationFrame(animFrame)
clearTimeout(mvmt)
cheatsVisible = true
} else if (cheatsVisible) {
console.log()
if (key == "ArrowUp") {
cheatSelected -= 1
}
if (key == "ArrowDown") {
cheatSelected += 1
}
if (key == "Enter") {
if (cheatSelected == 0) {
wallcheat = !wallcheat
} else if (cheatSelected == 1) {
trailcheat = !trailcheat
} else if (cheatSelected == 2) {
applecheat = !applecheat
} else if (cheatSelected == 3) {
bot = !bot
} else if (cheatSelected == 4) {
var palettes = Object.keys(colorPalettes)
var index = palettes.indexOf(colorPalette)
var next = palettes[index + 1]
if (!next) { next = palettes[0] }
colorPalette = next
render()
cancelAnimationFrame(animFrame)
} else {
cheatsVisible = false
render()
mvmt = setTimeout(movement,100)
}
}
if (cheatSelected > 5) { cheatSelected = 0 }
if (cheatSelected < 0) { cheatSelected = 5 }
}
if (cheatsVisible) {
renderCheatsMenu()
}
}