From 223944523d12b14b71c8d50f477bfb89c5d2c9f7 Mon Sep 17 00:00:00 2001 From: tommy-l-ngo Date: Mon, 1 Nov 2021 15:22:03 -0500 Subject: [PATCH] Bug Fix: Rotating ships at the original position would move the other ships left for some reason - Issue fixed - Now the ships won't move when rotated in the original position - might make it so that the ships don't rotate in the original position in general --- godot_ship/script/game/moveShip.gd | 121 +++++++++++++++-------------- 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/godot_ship/script/game/moveShip.gd b/godot_ship/script/game/moveShip.gd index 8c8eb1f..9969071 100644 --- a/godot_ship/script/game/moveShip.gd +++ b/godot_ship/script/game/moveShip.gd @@ -107,73 +107,74 @@ func _input(event): 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): - get_parent().get_node("2Ship").position.y -= 32 - if (get_parent().get_node("2Ship").rotation_degrees == -90): - if (get_parent().get_node("2Ship").position.x > 308): - get_parent().get_node("2Ship").position.x -= 32 + if(position.x > 17.4 and position.x < 337.5) and (position.y > 20.2 and position.y < 335.5): + # 2-Ship + if (get_parent().get_node("2Ship").rotation_degrees == 0): + if (get_parent().get_node("2Ship").position.y > 308): + get_parent().get_node("2Ship").position.y -= 32 + if (get_parent().get_node("2Ship").rotation_degrees == -90): + if (get_parent().get_node("2Ship").position.x > 308): + get_parent().get_node("2Ship").position.x -= 32 - # 3-Ship A - if (get_parent().get_node("3ShipA").rotation_degrees == 0): - if (get_parent().get_node("3ShipA").position.y > 308): - get_parent().get_node("3ShipA").position.y -= 32 - if (get_parent().get_node("3ShipA").position.y < 52): - get_parent().get_node("3ShipA").position.y += 32 - if (get_parent().get_node("3ShipA").rotation_degrees == -90): - if (get_parent().get_node("3ShipA").position.x > 308): - get_parent().get_node("3ShipA").position.x -= 32 - if (get_parent().get_node("3ShipA").position.x < 52): - get_parent().get_node("3ShipA").position.x += 32 - - # 3-Ship B - if (get_parent().get_node("3ShipB").rotation_degrees == 0): - if (get_parent().get_node("3ShipB").position.y > 308): - get_parent().get_node("3ShipB").position.y -= 32 - if (get_parent().get_node("3ShipB").position.y < 52): - get_parent().get_node("3ShipB").position.y += 32 - if (get_parent().get_node("3ShipB").rotation_degrees == -90): - if (get_parent().get_node("3ShipB").position.x > 308): - get_parent().get_node("3ShipB").position.x -= 32 - if (get_parent().get_node("3ShipB").position.x < 52): - get_parent().get_node("3ShipB").position.x += 32 - - # 4-Ship - if (get_parent().get_node("4Ship").rotation_degrees == 0): - if (get_parent().get_node("4Ship").position.y > 276.8): - get_parent().get_node("4Ship").position.y -= 32 - if (get_parent().get_node("4Ship").position.y > 308.8): + # 3-Ship A + if (get_parent().get_node("3ShipA").rotation_degrees == 0): + if (get_parent().get_node("3ShipA").position.y > 308): + get_parent().get_node("3ShipA").position.y -= 32 + if (get_parent().get_node("3ShipA").position.y < 52): + get_parent().get_node("3ShipA").position.y += 32 + if (get_parent().get_node("3ShipA").rotation_degrees == -90): + if (get_parent().get_node("3ShipA").position.x > 308): + get_parent().get_node("3ShipA").position.x -= 32 + if (get_parent().get_node("3ShipA").position.x < 52): + get_parent().get_node("3ShipA").position.x += 32 + + # 3-Ship B + if (get_parent().get_node("3ShipB").rotation_degrees == 0): + if (get_parent().get_node("3ShipB").position.y > 308): + get_parent().get_node("3ShipB").position.y -= 32 + if (get_parent().get_node("3ShipB").position.y < 52): + get_parent().get_node("3ShipB").position.y += 32 + if (get_parent().get_node("3ShipB").rotation_degrees == -90): + if (get_parent().get_node("3ShipB").position.x > 308): + get_parent().get_node("3ShipB").position.x -= 32 + if (get_parent().get_node("3ShipB").position.x < 52): + get_parent().get_node("3ShipB").position.x += 32 + + # 4-Ship + if (get_parent().get_node("4Ship").rotation_degrees == 0): + if (get_parent().get_node("4Ship").position.y > 276.8): get_parent().get_node("4Ship").position.y -= 32 - if (get_parent().get_node("4Ship").position.y < 52): - get_parent().get_node("4Ship").position.y += 32 - if (get_parent().get_node("4Ship").rotation_degrees == -90): - if (get_parent().get_node("4Ship").position.x > 276.8): - get_parent().get_node("4Ship").position.x -= 32 - if (get_parent().get_node("4Ship").position.y > 308.8): + if (get_parent().get_node("4Ship").position.y > 308.8): + get_parent().get_node("4Ship").position.y -= 32 + if (get_parent().get_node("4Ship").position.y < 52): + get_parent().get_node("4Ship").position.y += 32 + if (get_parent().get_node("4Ship").rotation_degrees == -90): + if (get_parent().get_node("4Ship").position.x > 276.8): get_parent().get_node("4Ship").position.x -= 32 - if (get_parent().get_node("4Ship").position.x < 52): - get_parent().get_node("4Ship").position.x += 32 - - # 5-Ship - if (get_parent().get_node("5Ship").rotation_degrees == 0): - if (get_parent().get_node("5Ship").position.y > 276.8): - get_parent().get_node("5Ship").position.y -= 32 - if (get_parent().get_node("5Ship").position.y > 308.8): + if (get_parent().get_node("4Ship").position.y > 308.8): + get_parent().get_node("4Ship").position.x -= 32 + if (get_parent().get_node("4Ship").position.x < 52): + get_parent().get_node("4Ship").position.x += 32 + + # 5-Ship + if (get_parent().get_node("5Ship").rotation_degrees == 0): + if (get_parent().get_node("5Ship").position.y > 276.8): get_parent().get_node("5Ship").position.y -= 32 - if (get_parent().get_node("5Ship").position.y < 84.8): - get_parent().get_node("5Ship").position.y += 32 - if (get_parent().get_node("5Ship").position.y < 52): + if (get_parent().get_node("5Ship").position.y > 308.8): + get_parent().get_node("5Ship").position.y -= 32 + if (get_parent().get_node("5Ship").position.y < 84.8): get_parent().get_node("5Ship").position.y += 32 - if (get_parent().get_node("5Ship").rotation_degrees == -90): - if (get_parent().get_node("5Ship").position.x > 276.8): - get_parent().get_node("5Ship").position.x -= 32 - if (get_parent().get_node("5Ship").position.x > 308.8): + if (get_parent().get_node("5Ship").position.y < 52): + get_parent().get_node("5Ship").position.y += 32 + if (get_parent().get_node("5Ship").rotation_degrees == -90): + if (get_parent().get_node("5Ship").position.x > 276.8): get_parent().get_node("5Ship").position.x -= 32 - if (get_parent().get_node("5Ship").position.x < 84.8): - get_parent().get_node("5Ship").position.x += 32 - if (get_parent().get_node("5Ship").position.x < 52): + if (get_parent().get_node("5Ship").position.x > 308.8): + get_parent().get_node("5Ship").position.x -= 32 + if (get_parent().get_node("5Ship").position.x < 84.8): get_parent().get_node("5Ship").position.x += 32 + if (get_parent().get_node("5Ship").position.x < 52): + get_parent().get_node("5Ship").position.x += 32 # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta):