summaryrefslogtreecommitdiff
path: root/src/sliceitoff/field/field.py
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-03-16 15:11:12 +0200
committerViljami Ilola <+@hix.fi>2024-03-16 15:11:12 +0200
commit3d1e8a068f98a32e0146d8e9ab58dea49fbb4c74 (patch)
tree013814df21967af7dc9dfb390fd6de9770799616 /src/sliceitoff/field/field.py
parent77d104cced553b8dfc9896cb456bd039807ed6c6 (diff)
controls and gamelogic draft
Diffstat (limited to 'src/sliceitoff/field/field.py')
-rw-r--r--src/sliceitoff/field/field.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/sliceitoff/field/field.py b/src/sliceitoff/field/field.py
index 0681c64..13b5c6a 100644
--- a/src/sliceitoff/field/field.py
+++ b/src/sliceitoff/field/field.py
@@ -26,12 +26,12 @@ class Field():
return False
return True
- def slice(self, x: int, y: int, direction: bool, thickness: int) -> bool:
+ def slice(self, pos: tuple, direction: bool, thickness: int) -> bool:
""" Slice one area into two areas """
# Find the overlapping area
for area in self.areas:
- if self.coordinates_inside_area(area, x, y):
+ if self.coordinates_inside_area(area, pos[0], pos[1]):
break
else:
return False
@@ -43,8 +43,8 @@ class Field():
# create new areas if there is any space
if direction:
x1 = ax
- x2 = x - thickness
- x3 = x + thickness
+ x2 = pos[0] - thickness
+ x3 = pos[0] + thickness
x4 = ax + aw
if x2 > x1:
@@ -53,8 +53,8 @@ class Field():
self.areas.append( (x3, ay, x4-x3, ah) )
else:
y1 = ay
- y2 = y - thickness
- y3 = y + thickness
+ y2 = pos[1] - thickness
+ y3 = pos[1] + thickness
y4 = ay + ah
if y2 > y1: