Finalisierung Scene 2
This commit is contained in:
parent
6ce32a689d
commit
d1fcc7142b
Binary file not shown.
Binary file not shown.
|
@ -19,7 +19,7 @@ def setup_streets_scene_1():
|
||||||
return streets_list
|
return streets_list
|
||||||
|
|
||||||
|
|
||||||
def setup_lanterns_detectors_scene_1(SCREEN_WIDTH):
|
def setup_lanterns_detectors_scene_1():
|
||||||
lantern_list = []
|
lantern_list = []
|
||||||
detectors_list = []
|
detectors_list = []
|
||||||
|
|
||||||
|
@ -116,3 +116,75 @@ def setup_streets_scene_2():
|
||||||
streets_list = [street_1, street_2, street_3, street_4, street_5, street_6, street_7, street_8]
|
streets_list = [street_1, street_2, street_3, street_4, street_5, street_6, street_7, street_8]
|
||||||
|
|
||||||
return streets_list
|
return streets_list
|
||||||
|
|
||||||
|
def setup_lanterns_detectors_scene_2():
|
||||||
|
|
||||||
|
lantern_list = []
|
||||||
|
detectors_list = []
|
||||||
|
|
||||||
|
# intersection 1
|
||||||
|
cross_lantern_1 = sprites.Lanterns(825, 425, 25, 25, id=1, street="street_1", crossing_id=1)
|
||||||
|
cross_lantern_2 = sprites.Lanterns(975, 425, 25, 25, id=1, street="street_2", crossing_id=1)
|
||||||
|
cross_lantern_3 = sprites.Lanterns(975, 575, 25, 25, id=1, street="street_3", crossing_id=1)
|
||||||
|
cross_lantern_4 = sprites.Lanterns(825, 575, 25, 25, id=1, street="street_4", crossing_id=1)
|
||||||
|
cross_detector_1 = sprites.Detectors(900, 500, 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(425, 576, 150):
|
||||||
|
print("street 1")
|
||||||
|
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 2
|
||||||
|
for x_pos in range(825, 976, 150):
|
||||||
|
y_pos = 325
|
||||||
|
id = 2
|
||||||
|
while y_pos >= 25:
|
||||||
|
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)
|
||||||
|
print(y_pos)
|
||||||
|
y_pos -= 100
|
||||||
|
id += 1
|
||||||
|
|
||||||
|
# Street 3
|
||||||
|
for y_pos in range(425, 576, 150):
|
||||||
|
print("street 1")
|
||||||
|
x_pos = 1075
|
||||||
|
id = 2
|
||||||
|
while x_pos <= 1775:
|
||||||
|
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_3")
|
||||||
|
lantern_list.append(lantern)
|
||||||
|
detector = sprites.Detectors(x_pos, y_pos, 75, 90, id, street="street_3")
|
||||||
|
detectors_list.append(detector)
|
||||||
|
x_pos += 100
|
||||||
|
id += 1
|
||||||
|
|
||||||
|
# Street 4
|
||||||
|
for x_pos in range(825, 976, 150):
|
||||||
|
y_pos = 675
|
||||||
|
id = 2
|
||||||
|
while y_pos <= 975:
|
||||||
|
lantern = sprites.Lanterns(x_pos, y_pos, 25, 25, id, street="street_4")
|
||||||
|
lantern_list.append(lantern)
|
||||||
|
detector = sprites.Detectors(x_pos, y_pos, 200, 75, id, street="street_4")
|
||||||
|
detectors_list.append(detector)
|
||||||
|
print(y_pos)
|
||||||
|
y_pos += 100
|
||||||
|
id += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return lantern_list, detectors_list
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,11 @@ streets_list_scene_2 = setup.setup_streets_scene_2()
|
||||||
|
|
||||||
lanterns_scene_1 = pygame.sprite.Group()
|
lanterns_scene_1 = pygame.sprite.Group()
|
||||||
detectors_scene_1 = pygame.sprite.Group()
|
detectors_scene_1 = pygame.sprite.Group()
|
||||||
lantern_list_scene_1, detectors_list_scene_1 = setup.setup_lanterns_detectors_scene_1(SCREEN_WIDTH)
|
lantern_list_scene_1, detectors_list_scene_1 = setup.setup_lanterns_detectors_scene_1()
|
||||||
|
|
||||||
|
lanterns_scene_2 = pygame.sprite.Group()
|
||||||
|
detectors_scene_2 = pygame.sprite.Group()
|
||||||
|
lantern_list_scene_2, detectors_list_scene_2 = setup.setup_lanterns_detectors_scene_2()
|
||||||
|
|
||||||
current_scene = "scene_1"
|
current_scene = "scene_1"
|
||||||
|
|
||||||
|
@ -34,6 +38,10 @@ for item in streets_list_scene_1:
|
||||||
streets_scene_1.add(item)
|
streets_scene_1.add(item)
|
||||||
for item in streets_list_scene_2:
|
for item in streets_list_scene_2:
|
||||||
streets_scene_2.add(item)
|
streets_scene_2.add(item)
|
||||||
|
for item in lantern_list_scene_2:
|
||||||
|
lanterns_scene_2.add(item)
|
||||||
|
for item in detectors_list_scene_2:
|
||||||
|
detectors_scene_2.add(item)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,7 +55,7 @@ if __name__ == "__main__":
|
||||||
if current_scene == "scene_1":
|
if current_scene == "scene_1":
|
||||||
functions.scene_1(screen, detectors_scene_1, streets_scene_1, lanterns_scene_1, player)
|
functions.scene_1(screen, detectors_scene_1, streets_scene_1, lanterns_scene_1, player)
|
||||||
if current_scene == "scene_2":
|
if current_scene == "scene_2":
|
||||||
functions.scene_2(screen, detectors_scene_1, streets_scene_2, lanterns_scene_1, player)
|
functions.scene_2(screen, detectors_scene_2, streets_scene_2, lanterns_scene_2, player)
|
||||||
|
|
||||||
current_scene = player.sprite.left_scene(current_scene)
|
current_scene = player.sprite.left_scene(current_scene)
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,10 @@ class Player(pygame.sprite.Sprite):
|
||||||
self.rect.x = 900
|
self.rect.x = 900
|
||||||
self.rect.y = 1050
|
self.rect.y = 1050
|
||||||
return "scene_2"
|
return "scene_2"
|
||||||
|
if current_scene == "scene_2" and self.rect.y >= 1080:
|
||||||
|
self.rect.x = 900
|
||||||
|
self.rect.y = -80
|
||||||
|
return "scene_1"
|
||||||
return current_scene
|
return current_scene
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
|
Loading…
Reference in a new issue