diff --git a/HNS/Excercises/ShipCraft/main.py b/HNS/Excercises/ShipCraft/main.py index 42ad99a..6b98c6d 100644 --- a/HNS/Excercises/ShipCraft/main.py +++ b/HNS/Excercises/ShipCraft/main.py @@ -77,7 +77,7 @@ def draw_field(window, field): btn = Button(window, text='', width=5, height=2) btn.grid(column=c, row=r) btn.bind('', lambda e, x=r, y=c: left_button_click(field, x, y)) - btn.bind('', lambda e, x=r, y=c: right_button_click(field, x, y)) + btn.bind('', right_button_click) btn.bind('', lambda e, x=r, y=c: button_enter(field, x, y)) buttons.append(btn) @@ -105,9 +105,14 @@ def left_button_click(field, row, col): colorize(field, buttons) -def right_button_click(field, row, col): - pass - +def right_button_click(d): + global ship_direction + if field_mode == 0: + if ship_direction == 0: + ship_direction = 1 + else: + ship_direction = 0 + def button_enter(field, row, col): if field_mode == 0: