summaryrefslogtreecommitdiff
path: root/src/sliceitoff/player/player.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sliceitoff/player/player.py')
-rw-r--r--src/sliceitoff/player/player.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/sliceitoff/player/player.py b/src/sliceitoff/player/player.py
index 6e2ab0b..d36691c 100644
--- a/src/sliceitoff/player/player.py
+++ b/src/sliceitoff/player/player.py
@@ -17,13 +17,13 @@ class PlayerSprite(pygame.sprite.Sprite):
class Player():
def __init__(self, field = None, enemies = None):
- self.field = field
self.enemies = enemies
self.position = (200_000, 140_000)
self.direction = False
self.lazer = False
self.sprites = pygame.sprite.Group()
self.updated = True
+ self.field = field
def __update_sprites(self):
self.sprites.empty()
@@ -49,16 +49,13 @@ class Player():
def fire_lazer(self):
if DEBUG:
print("PLAYER: fire lazer")
- # self.lazer = True
- # self.updated = True
hitbox = self.field.slice(self.position, self.direction, 4_500)
hit = False
if hitbox is not None:
- for enemy in self.enemies.sprites:
+ for enemy in self.enemies.sprites():
if hitbox.colliderect(enemy.rect):
hit = True
break
- self.field.kill_if_not_colliding(self.enemies.sprites)
return hit
def set_direction(self):