Vacuum Cleaner has no collision anymore. Added deadly zone for it when sparkling
parent
54bbcf7e86
commit
ab04fe2985
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue