From e4a92faaeae1a66fdf6290869bd5ed53cdcd969c Mon Sep 17 00:00:00 2001 From: tommy-l-ngo Date: Mon, 1 Nov 2021 00:37:40 -0500 Subject: [PATCH] Bug Fix: Ship rotating after placed on board are able to hang off - fixed this by moving ships back inside board when it hangs off after rotating --- godot_ship/script/game/moveShip.gd | 57 ++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/godot_ship/script/game/moveShip.gd b/godot_ship/script/game/moveShip.gd index eef2485..4b5315e 100644 --- a/godot_ship/script/game/moveShip.gd +++ b/godot_ship/script/game/moveShip.gd @@ -106,6 +106,63 @@ func _input(event): else: rotate(PI/2) vertical = true + + # 2-Ship + if (get_parent().get_node("2Ship").rotation_degrees == 0): + if (get_parent().get_node("2Ship").position.y > 308): + position.y -= 32 + if (get_parent().get_node("2Ship").rotation_degrees == -90): + if (get_parent().get_node("2Ship").position.x > 308): + position.x -= 32 + + # 3-Ship A + if (get_parent().get_node("3ShipA").rotation_degrees == 0): + if (get_parent().get_node("3ShipA").position.y > 308): + position.y -= 32 + if (get_parent().get_node("3ShipA").position.y < 52): + position.y += 32 + if (get_parent().get_node("3ShipA").rotation_degrees == -90): + if (get_parent().get_node("3ShipA").position.x > 308): + position.x -= 32 + if (get_parent().get_node("3ShipA").position.x < 52): + position.x += 32 + + # 3-Ship B + if (get_parent().get_node("3ShipB").rotation_degrees == 0): + if (get_parent().get_node("3ShipB").position.y > 308): + position.y -= 32 + if (get_parent().get_node("3ShipB").position.y < 52): + position.y += 32 + if (get_parent().get_node("3ShipB").rotation_degrees == -90): + if (get_parent().get_node("3ShipB").position.x > 308): + position.x -= 32 + if (get_parent().get_node("3ShipB").position.x < 52): + position.x += 32 + + # 4-Ship + if (get_parent().get_node("4Ship").rotation_degrees == 0): + if (get_parent().get_node("4Ship").position.y > 276.8): + position.y -= 64 + if (get_parent().get_node("4Ship").position.y < 52): + position.y += 32 + if (get_parent().get_node("4Ship").rotation_degrees == -90): + if (get_parent().get_node("4Ship").position.x > 276.8): + position.x -= 64 + if (get_parent().get_node("4Ship").position.x < 52): + position.x += 32 + + # 5-Ship + if (get_parent().get_node("5Ship").rotation_degrees == 0): + if (get_parent().get_node("5Ship").position.y > 276.8): + position.y -= 64 + if (get_parent().get_node("5Ship").position.y < 84.8): + position.y += 64 + if (get_parent().get_node("5Ship").rotation_degrees == -90): + if (get_parent().get_node("5Ship").position.x > 276.8): + position.x -= 64 + if (get_parent().get_node("5Ship").position.x < 84.8): + position.x += 64 + # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass