Compare commits
2 commits
51cf6049cb
...
80ca962709
Author | SHA1 | Date | |
---|---|---|---|
moritz | 80ca962709 | ||
moritz | 178be4d5c3 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
172
code/setup.py
172
code/setup.py
|
@ -258,7 +258,7 @@ def setup_streets_scene_4():
|
|||
street_1 = sprites.Streets(200, 100, 1600, 4) # Street 1 Top Line
|
||||
street_2 = sprites.Streets(200, 200, 1600, 4) # Street 1 Bottom Line
|
||||
street_3 = sprites.Streets(200, 750, 1600, 4) # Street 2 Top Line
|
||||
street_4 = sprites.Streets(100, 850, 1600, 4) # Street 2 Bottom Linee
|
||||
street_4 = sprites.Streets(100, 850, 1700, 4) # Street 2 Bottom Linee
|
||||
street_5 = sprites.Streets(200, 200, 4, 550) # Street 3 right middle Line
|
||||
street_6 = sprites.Streets(100, 0, 4, 850) # Street 3 Left Line
|
||||
street_7 = sprites.Streets(200, 0, 4, 100) # Street 3 right top Line
|
||||
|
@ -327,4 +327,174 @@ def setup_lanterns_detectors_scene_4():
|
|||
y_pos += 100
|
||||
id += 1
|
||||
|
||||
return lantern_list, detectors_list
|
||||
|
||||
|
||||
def setup_streets_scene_5():
|
||||
street_1 = sprites.Streets(100, 100, 1700, 4) # Street 2 Top Line
|
||||
street_2 = sprites.Streets(200, 200, 1600, 4) # Street 2 Bottom Linee
|
||||
street_3 = sprites.Streets(100, 100, 4, 900) # Street 1 Left Line
|
||||
street_4 = sprites.Streets(200, 200, 4, 800) # Street 3 Right Line
|
||||
|
||||
streets_list = [street_1, street_2, street_3, street_4]
|
||||
|
||||
return streets_list
|
||||
|
||||
|
||||
def setup_lanterns_detectors_scene_5():
|
||||
|
||||
lantern_list = []
|
||||
detectors_list = []
|
||||
|
||||
cross_lantern_1 = sprites.Lanterns(225, 75, 25, 25, id=1, street="street_1", crossing_id=1)
|
||||
cross_lantern_2 = sprites.Lanterns(225, 225, 25, 25, id=1, street="street_1", crossing_id=1)
|
||||
cross_lantern_3 = sprites.Lanterns(75, 75, 25, 25, id=1, street="street_2", crossing_id=1)
|
||||
cross_lantern_4 = sprites.Lanterns(75, 225, 25, 25, id=1, street="street_2", crossing_id=1)
|
||||
cross_detector_1 = sprites.Detectors(150, 150, 260, 260, crossing_id=1)
|
||||
|
||||
lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
|
||||
detectors_list.append(cross_detector_1)
|
||||
|
||||
# Street 1
|
||||
for x_pos in range(75, 226, 150):
|
||||
y_pos = 325
|
||||
id = 2
|
||||
while y_pos <= 925:
|
||||
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
|
||||
lantern_list.append(lantern)
|
||||
detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_1")
|
||||
detectors_list.append(detector)
|
||||
y_pos += 100
|
||||
id += 1
|
||||
|
||||
# Street 2
|
||||
for y_pos in range(75, 226, 150):
|
||||
x_pos = 325
|
||||
id = 2
|
||||
while x_pos <= 1775:
|
||||
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
|
||||
lantern_list.append(lantern)
|
||||
detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_2")
|
||||
detectors_list.append(detector)
|
||||
x_pos += 100
|
||||
id += 1
|
||||
|
||||
return lantern_list, detectors_list
|
||||
|
||||
def setup_streets_scene_6():
|
||||
street_1 = sprites.Streets(0, 100, 1800, 4) # Street 1/2 Top Line
|
||||
street_2 = sprites.Streets(0, 200, 850, 4) # Street 1 Bottom Line
|
||||
street_3 = sprites.Streets(950, 200, 850, 4) # Street 2 Bottom Line
|
||||
street_4 = sprites.Streets(850, 200, 4, 800) # Street 3 Left Line
|
||||
street_5 = sprites.Streets(950, 200, 4, 800) # Street 3 Left Line
|
||||
|
||||
|
||||
streets_list = [street_1, street_2, street_3, street_4, street_5]
|
||||
|
||||
return streets_list
|
||||
|
||||
|
||||
def setup_lanterns_detectors_scene_6():
|
||||
|
||||
lantern_list = []
|
||||
detectors_list = []
|
||||
|
||||
cross_lantern_1 = sprites.Lanterns(825, 75, 25, 25, id=1, street="street_1", crossing_id=1)
|
||||
cross_lantern_2 = sprites.Lanterns(975, 75, 25, 25, id=1, street="street_2", crossing_id=1)
|
||||
cross_lantern_3 = sprites.Lanterns(825, 225, 25, 25, id=1, street="street_3", crossing_id=1)
|
||||
cross_lantern_4 = sprites.Lanterns(975, 225, 25, 25, id=1, street="street_3", crossing_id=1)
|
||||
cross_detector_1 = sprites.Detectors(900, 150, 260, 260, crossing_id=1)
|
||||
|
||||
lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
|
||||
detectors_list.append(cross_detector_1)
|
||||
|
||||
# Street 1
|
||||
for y_pos in range(75, 226, 150):
|
||||
x_pos = 725
|
||||
id = 2
|
||||
while x_pos >= 25:
|
||||
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
|
||||
lantern_list.append(lantern)
|
||||
detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_1")
|
||||
detectors_list.append(detector)
|
||||
x_pos -= 100
|
||||
id += 1
|
||||
|
||||
# Street 1
|
||||
for y_pos in range(75, 226, 150):
|
||||
x_pos = 1075
|
||||
id = 2
|
||||
while x_pos <= 1775:
|
||||
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
|
||||
lantern_list.append(lantern)
|
||||
detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_2")
|
||||
detectors_list.append(detector)
|
||||
x_pos += 100
|
||||
id += 1
|
||||
|
||||
# Street 1
|
||||
for x_pos in range(825, 976, 150):
|
||||
y_pos = 325
|
||||
id = 2
|
||||
while y_pos <= 925:
|
||||
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_3")
|
||||
lantern_list.append(lantern)
|
||||
detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_3")
|
||||
detectors_list.append(detector)
|
||||
y_pos += 100
|
||||
id += 1
|
||||
|
||||
return lantern_list, detectors_list
|
||||
|
||||
|
||||
def setup_streets_scene_7():
|
||||
street_1 = sprites.Streets(0, 100, 1700, 4) # Street 2 Top Line
|
||||
street_2 = sprites.Streets(0, 200, 1600, 4) # Street 2 Bottom Linee
|
||||
street_3 = sprites.Streets(1700, 100, 4, 900) # Street 1 Left Line
|
||||
street_4 = sprites.Streets(1600, 200, 4, 800) # Street 3 Right Line
|
||||
|
||||
streets_list = [street_1, street_2, street_3, street_4]
|
||||
|
||||
return streets_list
|
||||
|
||||
def setup_lanterns_detectors_scene_7():
|
||||
|
||||
lantern_list = []
|
||||
detectors_list = []
|
||||
|
||||
cross_lantern_1 = sprites.Lanterns(1575, 75, 25, 25, id=1, street="street_1", crossing_id=1)
|
||||
cross_lantern_2 = sprites.Lanterns(1725, 75, 25, 25, id=1, street="street_1", crossing_id=1)
|
||||
cross_lantern_3 = sprites.Lanterns(1575, 225, 25, 25, id=1, street="street_2", crossing_id=1)
|
||||
cross_lantern_4 = sprites.Lanterns(1725, 225, 25, 25, id=1, street="street_2", crossing_id=1)
|
||||
cross_detector_1 = sprites.Detectors(1650, 150, 260, 260, crossing_id=1)
|
||||
|
||||
lantern_list.extend([cross_lantern_1, cross_lantern_2, cross_lantern_3, cross_lantern_4])
|
||||
detectors_list.append(cross_detector_1)
|
||||
|
||||
# Street 1
|
||||
for y_pos in range(75, 226, 150):
|
||||
x_pos = 1475
|
||||
id = 2
|
||||
while x_pos >= 75:
|
||||
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_1")
|
||||
lantern_list.append(lantern)
|
||||
detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_1")
|
||||
detectors_list.append(detector)
|
||||
x_pos -= 100
|
||||
id += 1
|
||||
|
||||
# Street 2
|
||||
for x_pos in range(1575, 1726, 150):
|
||||
y_pos = 325
|
||||
id = 2
|
||||
while y_pos <= 925:
|
||||
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_2")
|
||||
lantern_list.append(lantern)
|
||||
detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_2")
|
||||
detectors_list.append(detector)
|
||||
y_pos += 100
|
||||
id += 1
|
||||
|
||||
|
||||
|
||||
return lantern_list, detectors_list
|
|
@ -26,6 +26,15 @@ streets_list_scene_3 = setup.setup_streets_scene_3()
|
|||
streets_scene_4 = pygame.sprite.Group()
|
||||
streets_list_scene_4 = setup.setup_streets_scene_4()
|
||||
|
||||
streets_scene_5 = pygame.sprite.Group()
|
||||
streets_list_scene_5 = setup.setup_streets_scene_5()
|
||||
|
||||
streets_scene_6 = pygame.sprite.Group()
|
||||
streets_list_scene_6 = setup.setup_streets_scene_6()
|
||||
|
||||
streets_scene_7 = pygame.sprite.Group()
|
||||
streets_list_scene_7 = setup.setup_streets_scene_7()
|
||||
|
||||
|
||||
lanterns_scene_1 = pygame.sprite.Group()
|
||||
detectors_scene_1 = pygame.sprite.Group()
|
||||
|
@ -43,6 +52,18 @@ lanterns_scene_4 = pygame.sprite.Group()
|
|||
detectors_scene_4 = pygame.sprite.Group()
|
||||
lantern_list_scene_4, detectors_list_scene_4 = setup.setup_lanterns_detectors_scene_4()
|
||||
|
||||
lanterns_scene_5 = pygame.sprite.Group()
|
||||
detectors_scene_5 = pygame.sprite.Group()
|
||||
lantern_list_scene_5, detectors_list_scene_5 = setup.setup_lanterns_detectors_scene_5()
|
||||
|
||||
lanterns_scene_6 = pygame.sprite.Group()
|
||||
detectors_scene_6 = pygame.sprite.Group()
|
||||
lantern_list_scene_6, detectors_list_scene_6 = setup.setup_lanterns_detectors_scene_6()
|
||||
|
||||
lanterns_scene_7 = pygame.sprite.Group()
|
||||
detectors_scene_7 = pygame.sprite.Group()
|
||||
lantern_list_scene_7, detectors_list_scene_7 = setup.setup_lanterns_detectors_scene_7()
|
||||
|
||||
|
||||
current_scene = "scene_1"
|
||||
|
||||
|
@ -74,6 +95,26 @@ for item in lantern_list_scene_4:
|
|||
for item in detectors_list_scene_4:
|
||||
detectors_scene_4.add(item)
|
||||
|
||||
for item in streets_list_scene_5:
|
||||
streets_scene_5.add(item)
|
||||
for item in lantern_list_scene_5:
|
||||
lanterns_scene_5.add(item)
|
||||
for item in detectors_list_scene_5:
|
||||
detectors_scene_5.add(item)
|
||||
|
||||
for item in streets_list_scene_6:
|
||||
streets_scene_6.add(item)
|
||||
for item in lantern_list_scene_6:
|
||||
lanterns_scene_6.add(item)
|
||||
for item in detectors_list_scene_6:
|
||||
detectors_scene_6.add(item)
|
||||
|
||||
for item in streets_list_scene_7:
|
||||
streets_scene_7.add(item)
|
||||
for item in lantern_list_scene_7:
|
||||
lanterns_scene_7.add(item)
|
||||
for item in detectors_list_scene_7:
|
||||
detectors_scene_7.add(item)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -91,6 +132,12 @@ if __name__ == "__main__":
|
|||
functions.scene_2(screen, detectors_scene_3, streets_scene_3, lanterns_scene_3, player)
|
||||
if current_scene == "scene_4":
|
||||
functions.scene_2(screen, detectors_scene_4, streets_scene_4, lanterns_scene_4, player)
|
||||
if current_scene == "scene_5":
|
||||
functions.scene_2(screen, detectors_scene_5, streets_scene_5, lanterns_scene_5, player)
|
||||
if current_scene == "scene_6":
|
||||
functions.scene_2(screen, detectors_scene_6, streets_scene_6, lanterns_scene_6, player)
|
||||
if current_scene == "scene_7":
|
||||
functions.scene_2(screen, detectors_scene_7, streets_scene_7, lanterns_scene_7, player)
|
||||
|
||||
current_scene = player.sprite.left_scene(current_scene)
|
||||
|
||||
|
|
|
@ -47,6 +47,9 @@ class Player(pygame.sprite.Sprite):
|
|||
if current_scene == "scene_1" and self.rect.x <= -80:
|
||||
self.rect.x = 1880
|
||||
return "scene_3"
|
||||
if current_scene == "scene_1" and self.rect.y <= -80:
|
||||
self.rect.y = 1080
|
||||
return "scene_6"
|
||||
if current_scene == "scene_2" and self.rect.y <= -80:
|
||||
self.rect.x = 900
|
||||
self.rect.y = 1050
|
||||
|
@ -60,12 +63,33 @@ class Player(pygame.sprite.Sprite):
|
|||
if current_scene == "scene_3" and self.rect.y >= 1080:
|
||||
self.rect.y = -80
|
||||
return "scene_4"
|
||||
if current_scene == "scene_3" and self.rect.y <= -80:
|
||||
self.rect.y = 1080
|
||||
return "scene_5"
|
||||
if current_scene == "scene_4" and self.rect.x >= 1880:
|
||||
self.rect.x = -80
|
||||
return "scene_2"
|
||||
if current_scene == "scene_4" and self.rect.y <= -80:
|
||||
self.rect.y = 1080
|
||||
return "scene_3"
|
||||
return "scene_3"
|
||||
if current_scene == "scene_5" and self.rect.y >= 1080:
|
||||
self.rect.y = -80
|
||||
return "scene_3"
|
||||
if current_scene == "scene_5" and self.rect.x >= 1880:
|
||||
self.rect.x = -80
|
||||
return "scene_6"
|
||||
if current_scene == "scene_6" and self.rect.x <= -80:
|
||||
self.rect.x = 1880
|
||||
return "scene_5"
|
||||
if current_scene == "scene_6" and self.rect.y >= 1080:
|
||||
self.rect.y = -80
|
||||
return "scene_1"
|
||||
if current_scene == "scene_6" and self.rect.x >= 1880:
|
||||
self.rect.x = -80
|
||||
return "scene_7"
|
||||
if current_scene == "scene_7" and self.rect.x <= -80:
|
||||
self.rect.x = 1880
|
||||
return "scene_6"
|
||||
return current_scene
|
||||
|
||||
def update(self):
|
||||
|
|
Loading…
Reference in a new issue