diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-18 13:05:58 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-18 13:05:58 +0200 |
commit | b00fe8fe50392a75529864fe03399fa3a0976143 (patch) | |
tree | 4f61dbc5b771605984bb3c34d0b8a423c8a8c24c /src/sliceitoff/enemies | |
parent | 8781f3b04dff7434d302f7606cdcb0d2c1523cf8 (diff) |
internal resolution x10. get rid of rest get_sprites functions
Diffstat (limited to 'src/sliceitoff/enemies')
-rw-r--r-- | src/sliceitoff/enemies/enemies.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/sliceitoff/enemies/enemies.py b/src/sliceitoff/enemies/enemies.py index b0ac187..6a9fda4 100644 --- a/src/sliceitoff/enemies/enemies.py +++ b/src/sliceitoff/enemies/enemies.py @@ -56,8 +56,8 @@ class Enemies(): def emerge_enemies(self): for _ in range(self.level * 1): enemy = EnemyBall() - enemy.set_position( (randrange(0,38_000), randrange(0,26_000)) ) - enemy.set_movement( (randrange(0,400)-200, randrange(0,400)-200) ) + enemy.set_position( (randrange(0,380_000), randrange(0,260_000)) ) + enemy.set_movement( (randrange(0,200)-100, randrange(0,200)-100) ) self.sprites.add(enemy) def wall_hit(self, field, enemy): @@ -70,8 +70,9 @@ class Enemies(): if ( enemy.rect.y + enemy.rect.h >= field.rect.y + field.rect.h ): enemy.force_up() - def get_sprites(self): - self.sprites.update(move=1) + def update(self, dt): + """ Update sprites basis of dt. dt = milliseconds from last update """ + self.sprites.update(move=dt) for enemy in self.sprites: for field in self.field.sprites: if field.rect.contains(enemy): @@ -80,5 +81,3 @@ class Enemies(): for field in self.field.sprites: if field.rect.colliderect(enemy): self.wall_hit(field, enemy) - - return self.sprites |