1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-14 21:15:58 +00:00

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
This commit is contained in:
tommy-l-ngo 2021-11-01 00:37:40 -05:00
parent cb661106c3
commit e4a92faaea

View File

@ -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