-
Notifications
You must be signed in to change notification settings - Fork 2
/
sounds.p8
241 lines (220 loc) · 14.1 KB
/
sounds.p8
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
-- something for your ear holes!
-- bright moth games
step = .01667 -- our framerate, 1/60
function _init()
menuitem(1, "next demo", loadnextdemo)
frames = { 3, 4, 2, 1}
frametime = 0
frameidx = 1
speed = 30
x,y = 60, 60
walking = false
left = false
jumping = false
onground = false
jumptime = 0
crouched = false
camx = 0
end
function _update60()
frametime += 1
walking = false
jumping = false
crouched = false
onground = false
local leftcells = getleftcells()
if(btn(0) and x > 0 and not hardright(leftcells.a) and not hardright(leftcells.b)) then
x -= speed * step
walking = true
left = true
if(camx > 0 and x - camx < 28) camx -= speed * step
end
local rightcells = getrightcells()
if(btn(1) and x < 248 and not hardleft(rightcells.a) and not hardleft(rightcells.b)) then
x += speed * step
walking = true
left = false
if(camx + 128 < 256 and x - camx > 100) camx += speed * step
end
local belowcells = getbottomcells()
if(hardtop(belowcells.a) or hardtop(belowcells.b)) then
onground = true
jumptime = 0
end
if(btn(3) and not walking and onground) then
frameidx = 9
crouched = true
end
if(btn(5) and (onground or jumptime < 36)) then
jumping = true
-- if we're on the ground then
-- we just started jumping!
-- play jump sound!
if(onground) then
sfx(8)
end
onground = false
y -= speed * step
end
if(not onground) then
if(jumping) then
frameidx = 5
jumptime += 1
else
frameidx = 6
y += speed * step
jumptime = 36
end
else
jumptime = 0
if(walking) then
if(frametime > 10) then
frametime = 0
frameidx += 1
-- if our animation is a
-- step down frame, play a
-- step sound!
if(frameidx == 1) sfx(9)
if(frameidx == 3) sfx(10)
end
if(frameidx > 4) then
-- make sure we play our
-- step sound when the
-- frames loop around
sfx(9)
frameidx = 1
end
elseif(not crouched) then
frametime = 0
frameidx = 0
end
end
end
function _draw()
camera(camx, 0)
cls(12)
map(0,0,0,28,32,16)
if(onground and walking) then
spr(frames[frameidx], x, y, 1, 1, left)
else
spr(frameidx, x, y, 1, 1, left)
end
camera(0, 0)
print("sounds", 104, 122, 7)
end
function getplayercell()
local xo = 0
if(left) xo = -3
return getcell(x + 5 + xo, y + 4)
end
function getleftcells()
local cells = {}
cells.a = getcell(x + 1, y + 4)
cells.b = getcell(x + 1, y + 7)
return cells
end
function getrightcells()
local cells = {}
cells.a = getcell(x + 6, y + 4)
cells.b = getcell(x + 6, y + 7)
return cells
end
function getbottomcells()
local cells = {}
cells.a = getcell(x + 3, y + 8)
cells.b = getcell(x + 5, y + 8)
return cells
end
function getcell(wx, wy)
local cell = {}
cell.x = flr(wx / 8)
cell.y = flr((wy - 28)/8)
return cell
end
function hardleft(cell)
local cellid = mget(cell.x, cell.y)
return fget(cellid, 1)
end
function hardright(cell)
local cellid = mget(cell.x, cell.y)
return fget(cellid, 2)
end
function hardtop(cell)
local cellid = mget(cell.x, cell.y)
return fget(cellid, 0)
end
-->8
-- demo switching
function loadnextdemo()
load('parallax.p8', 'previous demo')
end
__gfx__
002d2200002d2200002d2200002d2200002d2200002d2200028d2200220000000000000000000000000000000000000000000000000000000000000000000000
00822400008224000082240000822400008224000882440028224400022800000000000000000000000000000000000000000000000000000000000000000000
008244000082440000824400008244000082440008224400222244000282d200028d2200002d2200000000000000000000000000000000000000000000000000
00229a0000229a0000229a0000229a0000229a0002229a4004429a00022244002822440000822400000000000000000000000000000000000000000000000000
00024a0000024a000004aa400042a40000024a000049aa000009aa40002244002222440000824400000000000000000000000000000000000000000000000000
000a4a00000aa4000009490000099a40000aa400049aad0000aaad0000049a4000029a4000229a40000000000000000000000000000000000000000000000000
0000d5000001d50000050d00000d05000001dd0000d01000000d01000049aad00004aaa000024a90000000000000000000000000000000000000000000000000
000011000000100000100100001001000000100001000000000010000000151000914a100091a410000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000777700000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000007777770077000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000077777677777707700000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000077777767777677770000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000067777767777767770000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000067777777677767760000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000006667777766777000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000066666677000000000000000000000000000000000000000000000000000000000000000000000
3b3b3b3b444444443b3b3b3b3b3b3b3b44444b3b3b3444443b44444444444b3b3b344b3b000000003b3b3b3b0000000000000000000000000000000000000000
b3b3b3b344444444b3b3b3b3b3b3b3b3444443b3b3b44444b3b44444444444b3b3b443b300000000b3b3b3b30000000000000000000000000000000000000000
44344434444444443b34443444344b3b44444434443444443b44444444444b3b44344434000000003b344b3b0000000000000000000000000000000000000000
4444444444444444b3b44444444444b34444444444444444b3b44444444444b34444444400000000b3b444b30000000000000000000000000000000000000000
44444444444444443b44444444444b3b44444444444444443b44444444444b3b44444444000000003b444b3b0000000000000000000000000000000000000000
4444444444444444b3b44444444444b34444444444444444b3b44444444444b34444444400000000b3b444b30000000000000000000000000000000000000000
44444444444444443b44444444444b3b44444444444444443b44444444444b3b44444444000000003b444b3b0000000000000000000000000000000000000000
4444444444444444b3b44444444444b34444444444444444b3b44444444444b34444444400000000b3b444b30000000000000000000000000000000000000000
__gff__
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101030501010305010007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__map__
0000000026270000000000002627000000000026270000000026270000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0026270000000000002627000000000026270000000000000000000026270000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000002627000000000026270000000000000026270000000000000026270000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000002627000000000000000000000000000026270000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000262700000000000000000000002627000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000003230303300000000002627000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000003631313700000000000000002627000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000003233000000000000323531313433000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000323534330000003a00363131313137000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3030303030303030353131343030303830353131313134303030303030303030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3131313131313131313131313131313131313131313131313131313131313131000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__sfx__
000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010300000c55010551135511755118551005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500005000050000500
010200000c61018033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
010200000c6101a033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000