Commit e8a1a636 authored by Adam Blank's avatar Adam Blank
Browse files

fix enemy ships

parent 4c801760
No related merge requests found
Pipeline #118926 canceled with stage
Showing with 3 additions and 1 deletion
+3 -1
...@@ -8,6 +8,7 @@ WIDTH = 10 ...@@ -8,6 +8,7 @@ WIDTH = 10
class ShipIMG(ImageViewer): class ShipIMG(ImageViewer):
def __init__(self, path, len, id=None, dir=0): def __init__(self, path, len, id=None, dir=0):
super().__init__(path, id=id, zoom=False) super().__init__(path, id=id, zoom=False)
self.path = path
self.drag_start = None self.drag_start = None
self.start_offset = None self.start_offset = None
self.x_offset = 2 self.x_offset = 2
...@@ -21,12 +22,13 @@ class ShipIMG(ImageViewer): ...@@ -21,12 +22,13 @@ class ShipIMG(ImageViewer):
def rotate(self): def rotate(self):
self.dir = (self.dir + 1) % 2 self.dir = (self.dir + 1) % 2
self.change("assets/" + str(self.len) + "-" + ("vertical" if self.dir == 0 else "horizontal") + ".png")
if self.dir == 0: if self.dir == 0:
self.change(self.path.replace("horizontal", "vertical"))
self.styles.width, self.styles.height = WIDTH, self.len * HEIGHT self.styles.width, self.styles.height = WIDTH, self.len * HEIGHT
self.x_offset = 2 self.x_offset = 2
self.y_offset = 1 self.y_offset = 1
else: else:
self.change(self.path.replace("vertical", "horizontal"))
self.styles.width, self.styles.height = self.len * WIDTH, HEIGHT self.styles.width, self.styles.height = self.len * WIDTH, HEIGHT
self.x_offset = 2 self.x_offset = 2
self.y_offset = 1 self.y_offset = 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment