Merge remote-tracking branch 'origin/main'

main
Jonas Wächter 2023-03-29 16:42:17 +02:00
commit ea6b6f91bb
3 changed files with 10 additions and 3 deletions

View File

@ -18,11 +18,15 @@ class VacuumCleanerElement(StaticLevelElement):
self.danger = True
self.danger_time = 30
self.off_time = 50
self.is_collider = False
def tick(self, tick_data: TickData):
super().tick(tick_data)
self.animation_state_counter += tick_data.dt
if self.danger:
for collision in self.get_collides_with():
if collision.secondary_sprite.id == 'player':
self.level_screen_manager.player_death()
if self.animation_state_counter >= self.danger_time:
self.set_animation_state('off')
self.animation_state_counter = 0
@ -37,5 +41,4 @@ class VacuumCleanerElement(StaticLevelElement):
block_type = BLOCK_TYPES[self.tile['name']]
self.spritesheet = spritesheet_manager.get_sheet(block_type)
self.set_animation_state('on')
self.position_scale.position = self.tile['position']

View File

@ -31,7 +31,7 @@ class LevelScreenManager(ScreenManager):
def tick(self, tick_data: TickData):
if tick_data.key_manager.is_keymap_down(KeyManager.KEY_ESCAPE):
self.main_loop.select_level_selection(self.level.theme)
pygame.time.delay(100)
pygame.time.delay(200)
def player_death(self):
self.main_loop.player_death(self.level)

View File

@ -105,7 +105,11 @@ class MainLoop:
def player_success(self, level: Level):
next_level = self.parsed_levels_manager.find_next_level(level)
if next_level is not None:
self.select_level(next_level)
else:
print('WINNNNNN!!')
self.select_main_menu()
def select_main_menu(self):
self.set_game_state(self.GAME_STATE_MENU)