Skip to content

Commit 82e7833

Browse files
committed
committing stuff from forever ago, maybe won't work
1 parent 25b9434 commit 82e7833

File tree

5 files changed

+80
-31
lines changed

5 files changed

+80
-31
lines changed

demos/maze/main.py

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -181,52 +181,81 @@ def draw_player(self, erase=False):
181181
self.player_x, (self.player_y * 2) + 1, self.screen_player_bottom
182182
)
183183

184+
def is_wall(self, x, y):
185+
return (
186+
self.maze[y][x] == self.wall
187+
or (x < 0 or y < 0 or x >= len(self.maze[0]) or y >= len(self.maze))
188+
or (self.maze[y][x] == self.exit_point and not self.all_coins_collected)
189+
)
190+
191+
def is_exit(self, x, y):
192+
return self.maze[y][x] == self.exit_point and self.all_coins_collected
193+
184194
def move_player(self, direction):
185-
186-
195+
187196
# Move the player in the maze
188197
if direction == "u":
198+
new_x, new_y = self.player_x, self.player_y - 1
199+
elif direction == "d":
200+
new_x, new_y = self.player_x, self.player_y + 1
201+
elif direction == "l":
202+
new_x, new_y = self.player_x - 1, self.player_y
203+
elif direction == "r":
204+
new_x, new_y = self.player_x + 1, self.player_y
205+
189206
if (
190207
self.player_y > 0
191208
and self.maze[self.player_y - 1][self.player_x] != self.wall
192209
):
193-
if self.maze[self.player_y - 1][self.player_x] == self.exit_point and not self.all_coins_collected:
210+
if (
211+
self.maze[self.player_y - 1][self.player_x] == self.exit_point
212+
and not self.all_coins_collected
213+
):
194214
self.output_queue.put("SOUND " + sss_sounds.BEEP_14)
195215
return
196-
216+
197217
self.draw_player(erase=True)
198218
self.player_y -= 1
199219
elif direction == "d":
200220
if (
201221
self.player_y < len(self.maze) - 1
202222
and self.maze[self.player_y + 1][self.player_x] != self.wall
203223
):
204-
if self.maze[self.player_y + 1][self.player_x] == self.exit_point and not self.all_coins_collected:
224+
if (
225+
self.maze[self.player_y + 1][self.player_x] == self.exit_point
226+
and not self.all_coins_collected
227+
):
205228
self.output_queue.put("SOUND " + sss_sounds.BEEP_14)
206229
return
207-
230+
208231
self.draw_player(erase=True)
209232
self.player_y += 1
210233
elif direction == "l":
211234
if (
212235
self.player_x > 0
213236
and self.maze[self.player_y][self.player_x - 1] != self.wall
214237
):
215-
if self.maze[self.player_y][self.player_x - 1] == self.exit_point and not self.all_coins_collected:
238+
if (
239+
self.maze[self.player_y][self.player_x - 1] == self.exit_point
240+
and not self.all_coins_collected
241+
):
216242
self.output_queue.put("SOUND " + sss_sounds.BEEP_14)
217243
return
218-
244+
219245
self.draw_player(erase=True)
220246
self.player_x -= 1
221247
elif direction == "r":
222248
if (
223249
self.player_x < len(self.maze[0]) - 1
224250
and self.maze[self.player_y][self.player_x + 1] != self.wall
225251
):
226-
if self.maze[self.player_y][self.player_x + 1] == self.exit_point and not self.all_coins_collected:
252+
if (
253+
self.maze[self.player_y][self.player_x + 1] == self.exit_point
254+
and not self.all_coins_collected
255+
):
227256
self.output_queue.put("SOUND " + sss_sounds.BEEP_14)
228257
return
229-
258+
230259
self.draw_player(erase=True)
231260
self.player_x += 1
232261

@@ -245,7 +274,7 @@ def move_player(self, direction):
245274
# Check to see if player has reached the exit
246275
if self.player_y == self.exit_y and self.player_x == self.exit_x:
247276
if self.all_coins_collected:
248-
self.output_queue.put("SOUND " + sss_sounds.WIN_01)
277+
self.output_queue.put("SOUND " + sss_sounds.COLLECTED_ITEM)
249278
self.output_queue.put("WIN")
250279
self.stop()
251280

sss_sounds/alphabetize.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Alphebitize all the lines in sss_sounds.py
2+
3+
import os
4+
5+
6+
def alphabetize(file_path):
7+
with open(file_path, "r") as file:
8+
lines = file.readlines()
9+
lines.sort()
10+
with open(file_path, "w") as file:
11+
for line in lines:
12+
file.write(line)
13+
14+
15+
def main():
16+
alphabetize("sss_sounds/sss_sounds.py")
17+
18+
19+
if __name__ == "__main__":
20+
main()

sss_sounds/beep-7-good.mp3

-28.1 KB
Binary file not shown.

sss_sounds/sss_sounds.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,25 @@
99
BEEP_14 = "sss_sounds/beep-14.mp3"
1010
BEEP_15 = "sss_sounds/beep-15.mp3"
1111
BEEP_16 = "sss_sounds/beep-16.mp3"
12+
BLIP = "sss_sounds/blip.wav"
13+
BLURP_X = "sss_sounds/blurp_x.wav"
14+
CLICK = "sss_sounds/click.mp3"
15+
CLICK_BUTTON_MENU = "sss_sounds/click-button-menu.mp3"
16+
CLICK_EFFECT = "sss_sounds/click_effect.mp3"
17+
CLICK_GAME_MENU = "sss_sounds/click-game-menu.mp3"
18+
CLICK_MENU_APP = "sss_sounds/click-menu-app.mp3"
19+
CLIMB_ROPE_LOOP_00 = "sss_sounds/Climb_Rope_Loop_00.wav"
20+
COLLECTED_ITEM = "sss_sounds/collected-item.mp3"
21+
COLLECT_POINT_00 = "sss_sounds/Collect_Point_00.wav"
22+
COLLECT_POINT_01 = "sss_sounds/Collect_Point_01.wav"
23+
COLLECT_POINT_02 = "sss_sounds/Collect_Point_02.wav"
24+
CRAFT_00 = "sss_sounds/Craft_00.wav"
1225
END_FAIL_10_GOODBYE = "sss_sounds/end-fail-10-goodbye.mp3"
1326
END_FAIL_5 = "sss_sounds/end-fail-5.mp3"
1427
END_FAIL_6 = "sss_sounds/end-fail-6.mp3"
1528
END_FAIL_7 = "sss_sounds/end-fail-7.mp3"
1629
END_FAIL_8 = "sss_sounds/end-fail-8.mp3"
1730
END_WIN_5 = "sss_sounds/end-win-5.mp3"
18-
LEVEL_UP = "sss_sounds/level-up.mp3"
19-
SINISTER_LAUGH = "sss_sounds/sinister-laugh.mp3"
20-
TETRIS = "sss_sounds/Tetris.mp3"
21-
TICK = "sss_sounds/tick.mp3"
22-
UH_OH = "sss_sounds/uh-oh.mp3"
23-
CLIMB_ROPE_LOOP_00 = "sss_sounds/Climb_Rope_Loop_00.wav"
24-
COLLECT_POINT_00 = "sss_sounds/Collect_Point_00.wav"
25-
COLLECT_POINT_01 = "sss_sounds/Collect_Point_01.wav"
26-
COLLECT_POINT_02 = "sss_sounds/Collect_Point_02.wav"
27-
CRAFT_00 = "sss_sounds/Craft_00.wav"
2831
EXPLOSION_00 = "sss_sounds/Explosion_00.wav"
2932
EXPLOSION_01 = "sss_sounds/Explosion_01.wav"
3033
EXPLOSION_02 = "sss_sounds/Explosion_02.wav"
@@ -35,6 +38,7 @@
3538
HIT_01 = "sss_sounds/Hit_01.wav"
3639
HIT_02 = "sss_sounds/Hit_02.wav"
3740
HIT_03 = "sss_sounds/Hit_03.wav"
41+
INTRO_DRIVE_IDENT = "sss_sounds/intro-drive-ident.mp3"
3842
JINGLE_ACHIEVEMENT_00 = "sss_sounds/Jingle_Achievement_00.wav"
3943
JINGLE_ACHIEVEMENT_01 = "sss_sounds/Jingle_Achievement_01.wav"
4044
JINGLE_LOSE_00 = "sss_sounds/Jingle_Lose_00.wav"
@@ -45,6 +49,8 @@
4549
JUMP_01 = "sss_sounds/Jump_01.wav"
4650
JUMP_02 = "sss_sounds/Jump_02.wav"
4751
JUMP_03 = "sss_sounds/Jump_03.wav"
52+
LEVEL_UP = "sss_sounds/level-up.mp3"
53+
MECH_KEYBOARD_02 = "sss_sounds/mech-keyboard-02.mp3"
4854
MENU_NAVIGATE_00 = "sss_sounds/Menu_Navigate_00.wav"
4955
MENU_NAVIGATE_01 = "sss_sounds/Menu_Navigate_01.wav"
5056
MENU_NAVIGATE_02 = "sss_sounds/Menu_Navigate_02.wav"
@@ -60,16 +66,10 @@
6066
SHOOT_01 = "sss_sounds/Shoot_01.wav"
6167
SHOOT_02 = "sss_sounds/Shoot_02.wav"
6268
SHOOT_03 = "sss_sounds/Shoot_03.wav"
63-
BLIP = "sss_sounds/blip.wav"
64-
BLURP_X = "sss_sounds/blurp_x.wav"
65-
CLICK_BUTTON_MENU = "sss_sounds/click-button-menu.mp3"
66-
CLICK_GAME_MENU = "sss_sounds/click-game-menu.mp3"
67-
CLICK_MENU_APP = "sss_sounds/click-menu-app.mp3"
68-
CLICK = "sss_sounds/click.mp3"
69-
CLICK_EFFECT = "sss_sounds/click_effect.mp3"
70-
COLLECTED_ITEM = "sss_sounds/collected-item.mp3"
71-
INTRO_DRIVE_IDENT = "sss_sounds/intro-drive-ident.mp3"
72-
MECH_KEYBOARD_02 = "sss_sounds/mech-keyboard-02.mp3"
7369
SIMPLE_NOTIFICATION = "sss_sounds/simple-notification.mp3"
70+
SINISTER_LAUGH = "sss_sounds/sinister-laugh.mp3"
71+
TETRIS = "sss_sounds/Tetris.mp3"
72+
TICK = "sss_sounds/tick.mp3"
7473
TWO_SYMBOLS_MINIMAL_LOGO = "sss_sounds/two-symbols-minimal-logo.mp3"
74+
UH_OH = "sss_sounds/uh-oh.mp3"
7575
WRONG = "sss_sounds/wrong.mp3"

0 commit comments

Comments
 (0)