diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-31 10:51:03 +0300 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-31 10:51:03 +0300 |
commit | 1a4422be08ef234ed0666f13b13fc03506c197b3 (patch) | |
tree | ecd98ba534abcfaeae3d729f9040b36ffa3c6026 /src/sliceitoff/field | |
parent | af17f92e0beda893fb91ff757b76f2499e500666 (diff) |
python 3.10 and proper version number + lint
Diffstat (limited to 'src/sliceitoff/field')
-rw-r--r-- | src/sliceitoff/field/field.py | 34 |
1 files changed, 16 insertions, 18 deletions
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) |