diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-24 01:22:39 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-24 01:22:39 +0200 |
commit | cd128f5bc4fae39fb7e77683758d437f64eb4203 (patch) | |
tree | f4f3efbca3e11e7f6fb73a227ad09ef11918ec48 /src/sliceitoff/player/player.py | |
parent | 4353670f0cee67550b20dfcfd51b81386372f358 (diff) |
gameover, level x and level up screens
Diffstat (limited to 'src/sliceitoff/player/player.py')
-rw-r--r-- | src/sliceitoff/player/player.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/sliceitoff/player/player.py b/src/sliceitoff/player/player.py index de49083..c062f1c 100644 --- a/src/sliceitoff/player/player.py +++ b/src/sliceitoff/player/player.py @@ -12,7 +12,7 @@ class PlayerSprite(pygame.sprite.Sprite): self.image = image self.rect = self.image.get_rect() - def update(self, pos = None): + def update(self, pos = None, **kwargs): if pos: w, h = self.image.get_size() self.rect = self.image.get_rect().move(pos[0]-w//2,pos[1]-h//2) @@ -28,11 +28,13 @@ class Player(pygame.sprite.LayeredUpdates): image = pygame.transform.rotate(image, 90) self.add(PlayerSprite(image), layer = 1) - def update(self, pos = None, direction = False, dt = 0): - if not self.lazer: - if direction: - self.direction = not self.direction - self.switch_layer(0,1) - if pos: - super().update(pos = pos) - self.position = Scaling.scale_to_internal(pos) + def update(self, pos = None, direction = False, **kwargs): + if self.lazer: + direction = False + pos = None + super().update(pos = pos, **kwargs) + if direction: + self.direction = not self.direction + self.switch_layer(0,1) + if pos: + self.position = Scaling.scale_to_internal(pos) |