Another performance change

main
Yan Wittmann 2023-03-28 20:08:52 +02:00
parent beea6b1ee8
commit 00c051de02
3 changed files with 5 additions and 3 deletions

View File

@ -128,7 +128,7 @@ elif what_to_run == 'level':
pygame.display.set_caption("PM GAME") pygame.display.set_caption("PM GAME")
clock = pygame.time.Clock() clock = pygame.time.Clock()
frame_rate = 120 frame_rate = 30
spritesheet_manager = SpritesheetManager("data/sprites", "data/sprites/sprites.json") spritesheet_manager = SpritesheetManager("data/sprites", "data/sprites/sprites.json")
sprite_manager = SpriteManager() sprite_manager = SpriteManager()

View File

@ -58,8 +58,8 @@ class PhysicsElementsHandler:
skip_sprites = [] skip_sprites = []
for sprite in sorted_dynamic_sprites: for sprite in sorted_dynamic_sprites:
if sprite.last_effective_motion[1] == 0 and sprite.last_effective_motion[0] == 0 \ if sprite.last_effective_motion == (0, 0) and random.randint(0, 100) > 50\
and random.randint(0, 100) > 50: and not sprite.id == 'player':
skip_sprites.append(sprite) skip_sprites.append(sprite)
continue continue
sorted_dynamic_sprites = [sprite for sprite in sorted_dynamic_sprites if sprite not in skip_sprites] sorted_dynamic_sprites = [sprite for sprite in sorted_dynamic_sprites if sprite not in skip_sprites]

View File

@ -20,6 +20,8 @@ class PlayerSprite(DynamicSprite):
self.max_motion_horizontal_via_input = 5 self.max_motion_horizontal_via_input = 5
self.id = 'player'
def tick(self, tick_data: TickData): def tick(self, tick_data: TickData):
super().tick(tick_data) super().tick(tick_data)