Reordering Layout

This commit is contained in:
bleeptrack 2020-10-27 15:48:23 +01:00
parent 9f9548abcf
commit 4c1d70a99f
5 changed files with 60 additions and 58 deletions

View file

@ -118,7 +118,7 @@ func try_play(full_command):
var particles = preload("res://scenes/card_particles.tscn").instance() var particles = preload("res://scenes/card_particles.tscn").instance()
particles.position = position particles.position = position
get_parent().add_child(particles) get_parent().add_child(particles)
$"../../..".terminal.send_command(full_command) $"../../../..".terminal.send_command(full_command)
buuurn() buuurn()
game.energy -= energy game.energy -= energy
else: else:

View file

@ -2,6 +2,7 @@ extends Control
var card_store = {} var card_store = {}
var cards var cards
var card_radius = 1500
func _ready(): func _ready():
load_card_store() load_card_store()
@ -68,9 +69,9 @@ func arrange_cards():
var current_angle = -total_angle/2 var current_angle = -total_angle/2
for card in get_tree().get_nodes_in_group("cards"): for card in get_tree().get_nodes_in_group("cards"):
var target_position = Vector2(rect_size.x/2, rect_size.y + 1500) var target_position = Vector2(rect_size.x/2, rect_size.y + card_radius)
var target_rotation = current_angle var target_rotation = current_angle
var translation_vec = Vector2(0,-1500).rotated(current_angle/180.0*PI) var translation_vec = Vector2(0,-card_radius).rotated(current_angle/180.0*PI)
target_position += translation_vec target_position += translation_vec
current_angle += angle_between_cards current_angle += angle_between_cards
card._home_position = target_position card._home_position = target_position

View file

@ -5,18 +5,18 @@ var dragged = null
var current_chapter var current_chapter
var current_level var current_level
onready var terminal = $Rows/Columns/RightSide/Terminal onready var terminal = $Rows/Controls/Terminal
onready var input = terminal.input onready var input = terminal.input
onready var output = terminal.output onready var output = terminal.output
onready var repositories_node = $Rows/Columns/Repositories onready var repositories_node = $Rows/Columns/Repositories
var repositories = {} var repositories = {}
onready var level_select = $Rows/Columns/RightSide/TopStuff/Menu/LevelSelect onready var level_select = $Rows/Columns/LevelInfo/Menu/LevelSelect
onready var chapter_select = $Rows/Columns/RightSide/TopStuff/Menu/ChapterSelect onready var chapter_select = $Rows/Columns/LevelInfo/Menu/ChapterSelect
onready var next_level_button = $Rows/Columns/RightSide/TopStuff/Menu/NextLevelButton onready var next_level_button = $Rows/Columns/LevelInfo/Menu/NextLevelButton
onready var level_name = $Rows/Columns/RightSide/TopStuff/LevelPanel/LevelName onready var level_name = $Rows/Columns/LevelInfo/LevelPanel/LevelName
onready var level_description = $Rows/Columns/RightSide/TopStuff/LevelPanel/Text/LevelDescription onready var level_description = $Rows/Columns/LevelInfo/LevelPanel/Text/LevelDescription
onready var level_congrats = $Rows/Columns/RightSide/TopStuff/LevelPanel/Text/LevelCongrats onready var level_congrats = $Rows/Columns/LevelInfo/LevelPanel/Text/LevelCongrats
onready var cards = $Rows/Cards onready var cards = $Rows/Controls/Cards
func _ready(): func _ready():
var args = helpers.parse_args() var args = helpers.parse_args()

View file

@ -54,49 +54,42 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Columns" type="HSplitContainer" parent="Rows"] [node name="Columns" type="HBoxContainer" parent="Rows"]
margin_right = 1904.0 margin_right = 1904.0
margin_bottom = 784.0 margin_bottom = 784.0
mouse_filter = 2 mouse_filter = 2
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Repositories" type="HBoxContainer" parent="Rows/Columns"] [node name="Repositories" type="HBoxContainer" parent="Rows/Columns"]
margin_right = 1136.0 margin_right = 1266.0
margin_bottom = 784.0 margin_bottom = 784.0
mouse_filter = 2 mouse_filter = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 1.5 size_flags_stretch_ratio = 2.0
custom_constants/separation = 8 custom_constants/separation = 8
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="RightSide" type="VSplitContainer" parent="Rows/Columns"] [node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns"]
margin_left = 1148.0 margin_left = 1271.0
margin_right = 1904.0 margin_right = 1904.0
margin_bottom = 784.0 margin_bottom = 784.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="TopStuff" type="VBoxContainer" parent="Rows/Columns/RightSide"]
margin_right = 756.0
margin_bottom = 386.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="Menu" type="HBoxContainer" parent="Rows/Columns/RightSide/TopStuff"] [node name="Menu" type="HBoxContainer" parent="Rows/Columns/LevelInfo"]
margin_right = 756.0 margin_right = 633.0
margin_bottom = 35.0 margin_bottom = 35.0
[node name="ChapterSelect" type="OptionButton" parent="Rows/Columns/RightSide/TopStuff/Menu"] [node name="ChapterSelect" type="OptionButton" parent="Rows/Columns/LevelInfo/Menu"]
margin_right = 168.0 margin_right = 168.0
margin_bottom = 35.0 margin_bottom = 35.0
focus_mode = 0 focus_mode = 0
enabled_focus_mode = 0 enabled_focus_mode = 0
text = "Select chapter..." text = "Select chapter..."
[node name="LevelSelect" type="OptionButton" parent="Rows/Columns/RightSide/TopStuff/Menu"] [node name="LevelSelect" type="OptionButton" parent="Rows/Columns/LevelInfo/Menu"]
margin_left = 173.0 margin_left = 173.0
margin_right = 317.0 margin_right = 317.0
margin_bottom = 35.0 margin_bottom = 35.0
@ -105,7 +98,7 @@ enabled_focus_mode = 0
text = "Select level..." text = "Select level..."
expand_icon = true expand_icon = true
[node name="ReloadButton" type="Button" parent="Rows/Columns/RightSide/TopStuff/Menu"] [node name="ReloadButton" type="Button" parent="Rows/Columns/LevelInfo/Menu"]
margin_left = 322.0 margin_left = 322.0
margin_right = 401.0 margin_right = 401.0
margin_bottom = 35.0 margin_bottom = 35.0
@ -116,7 +109,7 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="CardsButton" type="Button" parent="Rows/Columns/RightSide/TopStuff/Menu"] [node name="CardsButton" type="Button" parent="Rows/Columns/LevelInfo/Menu"]
margin_left = 406.0 margin_left = 406.0
margin_right = 478.0 margin_right = 478.0
margin_bottom = 35.0 margin_bottom = 35.0
@ -127,7 +120,7 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="NextLevelButton" type="Button" parent="Rows/Columns/RightSide/TopStuff/Menu"] [node name="NextLevelButton" type="Button" parent="Rows/Columns/LevelInfo/Menu"]
margin_left = 483.0 margin_left = 483.0
margin_right = 593.0 margin_right = 593.0
margin_bottom = 35.0 margin_bottom = 35.0
@ -140,14 +133,14 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/RightSide/TopStuff"] [node name="LevelPanel" type="VBoxContainer" parent="Rows/Columns/LevelInfo"]
margin_top = 40.0 margin_top = 40.0
margin_right = 756.0 margin_right = 633.0
margin_bottom = 386.0 margin_bottom = 784.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelName" type="RichTextLabel" parent="Rows/Columns/RightSide/TopStuff/LevelPanel"] [node name="LevelName" type="RichTextLabel" parent="Rows/Columns/LevelInfo/LevelPanel"]
margin_right = 756.0 margin_right = 633.0
margin_bottom = 60.0 margin_bottom = 60.0
rect_min_size = Vector2( 0, 60 ) rect_min_size = Vector2( 0, 60 )
custom_fonts/normal_font = ExtResource( 7 ) custom_fonts/normal_font = ExtResource( 7 )
@ -156,13 +149,13 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Text" type="Control" parent="Rows/Columns/RightSide/TopStuff/LevelPanel"] [node name="Text" type="Control" parent="Rows/Columns/LevelInfo/LevelPanel"]
margin_top = 65.0 margin_top = 65.0
margin_right = 756.0 margin_right = 633.0
margin_bottom = 346.0 margin_bottom = 744.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/RightSide/TopStuff/LevelPanel/Text"] [node name="LevelDescription" type="RichTextLabel" parent="Rows/Columns/LevelInfo/LevelPanel/Text"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
size_flags_vertical = 3 size_flags_vertical = 3
@ -173,7 +166,7 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="LevelCongrats" type="RichTextLabel" parent="Rows/Columns/RightSide/TopStuff/LevelPanel/Text"] [node name="LevelCongrats" type="RichTextLabel" parent="Rows/Columns/LevelInfo/LevelPanel/Text"]
visible = false visible = false
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -185,28 +178,37 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Terminal" parent="Rows/Columns/RightSide" instance=ExtResource( 1 )] [node name="Controls" type="HBoxContainer" parent="Rows"]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 398.0
margin_right = 756.0
margin_bottom = 784.0
size_flags_vertical = 3
[node name="Cards" parent="Rows" instance=ExtResource( 3 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 789.0 margin_top = 789.0
margin_right = 1904.0 margin_right = 1904.0
margin_bottom = 1064.0 margin_bottom = 1064.0
mouse_filter = 2
size_flags_vertical = 3 size_flags_vertical = 3
size_flags_stretch_ratio = 0.35 size_flags_stretch_ratio = 0.35
[node name="Cards" parent="Rows/Controls" instance=ExtResource( 3 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 1266.0
margin_bottom = 275.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 2.0
[node name="Terminal" parent="Rows/Controls" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 1271.0
margin_right = 1904.0
margin_bottom = 275.0
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="SuccessSound" type="AudioStreamPlayer" parent="."] [node name="SuccessSound" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 8 ) stream = ExtResource( 8 )
[connection signal="button_down" from="Rows/Columns/RightSide/TopStuff/Menu/ChapterSelect" to="." method="repopulate_chapters"] [connection signal="button_down" from="Rows/Columns/LevelInfo/Menu/ChapterSelect" to="." method="repopulate_chapters"]
[connection signal="button_down" from="Rows/Columns/RightSide/TopStuff/Menu/LevelSelect" to="." method="repopulate_levels"] [connection signal="button_down" from="Rows/Columns/LevelInfo/Menu/LevelSelect" to="." method="repopulate_levels"]
[connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/ReloadButton" to="." method="reload_level"] [connection signal="pressed" from="Rows/Columns/LevelInfo/Menu/ReloadButton" to="." method="reload_level"]
[connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/CardsButton" to="." method="toggle_cards"] [connection signal="pressed" from="Rows/Columns/LevelInfo/Menu/CardsButton" to="." method="toggle_cards"]
[connection signal="pressed" from="Rows/Columns/RightSide/TopStuff/Menu/NextLevelButton" to="." method="load_next_level"] [connection signal="pressed" from="Rows/Columns/LevelInfo/Menu/NextLevelButton" to="." method="load_next_level"]
[connection signal="command_done" from="Rows/Columns/RightSide/Terminal" to="." method="update_repos"] [connection signal="command_done" from="Rows/Controls/Terminal" to="." method="update_repos"]

View file

@ -36,5 +36,4 @@ func _process(_delta):
#$Line.points[1] -= $Line.points[1].normalized()*30 #$Line.points[1] -= $Line.points[1].normalized()*30
#$Tip.position = $Line.points[0] #$Tip.position = $Line.points[0]
#$Tip.rotation = PI+$Line.points[1].angle_to($Line.points[0]) #$Tip.rotation = PI+$Line.points[1].angle_to($Line.points[0])
print($Line.points[1].angle_to($Line.points[0]))
$Tip.rotation = PI-$Line.points[1].angle_to($Line.points[0])+0.25 $Tip.rotation = PI-$Line.points[1].angle_to($Line.points[0])+0.25