-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscreens.coffee
166 lines (97 loc) · 4.02 KB
/
screens.coffee
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
156
157
158
159
160
161
162
163
164
165
166
class FixedScreens
constructor: (pre) ->
NUMLINES = 21
@show = (doc, noIndent = false) =>
lines = doc.split("\n")
lines = lines[0..NUMLINES-1] if lines.length > NUMLINES
lines.push "" while lines.length < NUMLINES
lines = lines.map( (l) -> " " + l) unless noIndent
pre.textContent = lines.join("\n")
compositeLine = (fg, bg) ->
result = ''
for n in [0 .. Math.max(fg.length, bg.length)]
fc = fg[n] || ' '
bc = bg[n] || ' '
nc = bc
if fc == '.'
nc = ' '
else if fc != ' '
nc = fc
result += nc
return result
@superimpose = (doc) =>
bglines = pre.textContent.split("\n")
fglines = doc.split("\n")
newText = []
for i in [0 .. Math.max(bglines.length, fglines.length) - 1]
newline = compositeLine(fglines[i] || "", bglines[i] || "")
newText.push(newline)
@show(newText.join("\n"), true)
showTitle: ->
# ASCII art: http://patorjk.com/software/taag/
@show('''
______ __ _ __
/ ____/ ______ / /_ (_) /_____
/ __/ | |/_/ __ \\/ __ \\/ / //_/ _ \\
/ /____> </ /_/ / /_/ / / ,< / __/
/_____/_/|_|\\____/_.___/_/_/|_|\\___/
By Chris Reuter
Age 12
*** ONE KEYSTROKE ONE PLAY ***
0 O
+|
O
''')
showTitleAlt: ->
@show('''
______ __ _ __
/ ____/ ______ / /_ (_) /_____
/ __/ | |/_/ __ \\/ __ \\/ / //_/ _ \\
/ /____> </ /_/ / /_/ / / ,< / __/
/_____/_/|_|\\____/_.___/_/_/|_|\\___/
By Chris Reuter
Age 12
0 O
`y
O
''')
showInstructions: ->
@show('''
______ __ _ __
/ ____/ ______ / /_ (_) /_____
/ __/ | |/_/ __ \\/ __ \\/ / //_/ _ \\
/ /____> </ /_/ / /_/ / / ,< / __/
/_____/_/|_|\\____/_.___/_/_/|_|\\___/
A, D -> left and right
S -> wheelie
* puddles slow you down
/=/ ramps make you jump IF
DOING A WHEELIE. Otherwise,
they make you CRASH
Jumping speeds you up; wheelies
slow you down a bit.
''')
showCrashed: ->
crashed = '''
______ __ ________
/.____/________.______/./_..___..____/././././
/./.../.___/.__.`/.___/.__.\\/._.\\/.__.././././
/./___/./.././_/.(__..)./././..__/./_/./_/_/_/
\\____/_/...\\__,_/____/_/./_/\\___/\\__,_(_|_|_)
'''
# Put back the leading spacess coffeescript removes:
crashed = crashed.split("\n").map( (l) -> " " + l).join("\n")
@superimpose(crashed)
showWin: (time) ->
win = """
_______ _ __ __
__/|___/|___/|_ / ____(_)___ (_)____/ /_ ___ ____/ / __/|___/|___/|_
| / / / / /_ / / __ \\/ / ___/ __ \\/ _ \\/ __ / | / / /
/_ __/_ __/_ __| / __/ / / / / / (__ ) / / / __/ /_/ / /_ __/_ __/_ __|
|/ |/ |/ /_/ /_/_/ /_/_/____/_/ /_/\\___/\\__,_/ |/ |/ |/
Your time: #{time}
"""
@show(win)
# _______ _ _ _____ ______ _____ _ _ _______
# |______ \___/ | | |_____] | |____/ |______
# |______ _/ \_ |_____| |_____] __|__ | \_ |______