summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-03-31 10:51:03 +0300
committerViljami Ilola <+@hix.fi>2024-03-31 10:51:03 +0300
commit1a4422be08ef234ed0666f13b13fc03506c197b3 (patch)
treeecd98ba534abcfaeae3d729f9040b36ffa3c6026 /src
parentaf17f92e0beda893fb91ff757b76f2499e500666 (diff)
python 3.10 and proper version number + lint
Diffstat (limited to 'src')
-rw-r--r--src/sliceitoff/enemies/enemies.py7
-rw-r--r--src/sliceitoff/field/field.py34
-rw-r--r--src/sliceitoff/game/level.py1
-rw-r--r--src/sliceitoff/text/text.py2
4 files changed, 23 insertions, 21 deletions
diff --git a/src/sliceitoff/enemies/enemies.py b/src/sliceitoff/enemies/enemies.py
index c52059f..ee8109b 100644
--- a/src/sliceitoff/enemies/enemies.py
+++ b/src/sliceitoff/enemies/enemies.py
@@ -1,3 +1,4 @@
+""" enemies.enemies - group for enemies for the leve"""
from random import randrange
import pygame
@@ -5,7 +6,8 @@ from .ball import EnemyBall
from .bouncher import EnemyBouncher
class Enemies(pygame.sprite.Group):
- def __init__(self, field = None, count = 0):
+ """ Init with count. Randomizing enemy types. Some are worth more. """
+ def __init__(self, count = 0):
super().__init__()
while count:
match randrange(0,4):
@@ -17,9 +19,8 @@ class Enemies(pygame.sprite.Group):
if count >= 2:
self.add(EnemyBouncher())
count -= 2
- self.field = field
- def update(self, field_rects = [], **kwargs):
+ def update(self, field_rects = None, **kwargs):
""" Do actions on enemies that are only partly on the fields """
super().update(**kwargs)
for enemy in self.sprites():
diff --git a/src/sliceitoff/field/field.py b/src/sliceitoff/field/field.py
index 58464de..93b4dba 100644
--- a/src/sliceitoff/field/field.py
+++ b/src/sliceitoff/field/field.py
@@ -86,30 +86,28 @@ class Field(pygame.sprite.LayeredUpdates):
# create new areas if there is any space
if direction:
- x1 = ax
- x2 = pos[0] - thickness
- x3 = pos[0] + thickness
- x4 = ax + aw
+ t2 = pos[0] - thickness
+ t3 = pos[0] + thickness
+ t4 = ax + aw
- if x2 > x1:
- self.add(FieldSprite( (x1, ay, x2-x1, ah) ))
- if x4 > x3:
- self.add(FieldSprite( (x3, ay, x4-x3, ah) ))
+ if t2 > ax:
+ self.add(FieldSprite( (ax, ay, t2-ax, ah) ))
+ if t4 > t3:
+ self.add(FieldSprite( (t3, ay, t4-t3, ah) ))
- area = x2, ay, x3-x2, ah
+ area = t2, ay, t3-t2, ah
else:
- y1 = ay
- y2 = pos[1] - thickness
- y3 = pos[1] + thickness
- y4 = ay + ah
+ t2 = pos[1] - thickness
+ t3 = pos[1] + thickness
+ t4 = ay + ah
- if y2 > y1:
- self.add(FieldSprite( (ax, y1, aw, y2-y1) ))
- if y4 > y3:
- self.add(FieldSprite( (ax, y3, aw, y4-y3) ))
+ if t2 > ay:
+ self.add(FieldSprite( (ax, ay, aw, t2-ay) ))
+ if t4 > t3:
+ self.add(FieldSprite( (ax, t3, aw, t4-t3) ))
- area = ax, y2, aw, y3-y2
+ area = ax, t2, aw, t3-t2
self.explode(area)
zap_spite = SliceSprite(area)
diff --git a/src/sliceitoff/game/level.py b/src/sliceitoff/game/level.py
index 085cbc9..c6633fd 100644
--- a/src/sliceitoff/game/level.py
+++ b/src/sliceitoff/game/level.py
@@ -11,6 +11,7 @@ from .show import Show
class Level(pygame.sprite.Group):
""" One level that can be played """
+ # pylint: disable = too-many-instance-attributes
def __init__(self, stats = None):
super().__init__()
self.stats = stats
diff --git a/src/sliceitoff/text/text.py b/src/sliceitoff/text/text.py
index c1fd7b8..c429110 100644
--- a/src/sliceitoff/text/text.py
+++ b/src/sliceitoff/text/text.py
@@ -65,6 +65,8 @@ class TextPage(pygame.sprite.Group):
grid Space for a character (w,h)
font Font loaded in Fonts.fonts dict
"""
+ # pylint: disable = too-many-arguments # all argumets necessaary
+
def __init__(
self,
text,