diff --git a/Battle Pong/GameSettings.gd b/Battle Pong/GameSettings.gd new file mode 100644 index 0000000000000000000000000000000000000000..5f143957ddb41b2b3b2ae524bcc291854bde4e2f --- /dev/null +++ b/Battle Pong/GameSettings.gd @@ -0,0 +1,155 @@ +extends Node + +export var rendering_enabled = false +export var learn_with_images = true + + +var game_playtime_per_step +var game_wins_to_reset +var game_port + +var image_format +var image_heigth +var image_width + +var trainer_ip +var trainer_port +var trainer_position + +var ball_height +var ball_width +var ball_speed_min +var ball_speed_max +var ball_speed_increment + +var player_one_length +var player_one_speed + +var player_two_length +var player_two_speed + +var path="data.json" + +var default_data = { + "game":{ + "playtime_per_step":0.1, + "wins_to_reset":21, + "port":9080 + }, + "image":{ + "format":"RGB8", + "height":60, + "width":100 + }, + "trainer":{ + "ip":"127.0.0.1", + "port":"9080", + "position":"Right" + }, + "ball":{ + "height":30, + "width":30, + "speed_min":300, + "speed_max":600, + "speed_increment":50 + }, + "player_one":{ + "length":60, + "speed":300 + }, + "player_two":{ + "length":60, + "speed":300 + } + } + +var data = default_data + +# Called when the node enters the scene tree for the first time. +func _ready(): + load_data() + pass # Replace with function body. + +func load_data(): + var file = File.new() + + if not file.file_exists(path): + reset_data() + return + + file.open(path, file.READ) + var text = file.get_as_text() + data = parse_json(text) + file.close() + update_settings() + +func save_data(): + data = { + "game":{ + "playtime_per_step":$"/root/GameSettings".game_playtime_per_step, + "wins_to_reset":$"/root/GameSettings".game_wins_to_reset, + "port":$"/root/GameSettings".game_port + }, + "image":{ + "format":$"/root/GameSettings".image_format, + "height":$"/root/GameSettings".image_heigth, + "width":$"/root/GameSettings".image_width + }, + "trainer":{ + "ip":$"/root/GameSettings".trainer_ip, + "port":$"/root/GameSettings".trainer_port, + "position":$"/root/GameSettings".trainer_position + }, + "ball":{ + "height":$"/root/GameSettings".ball_height, + "width":$"/root/GameSettings".ball_width, + "speed_min":$"/root/GameSettings".ball_speed_min, + "speed_max":$"/root/GameSettings".ball_speed_max, + "speed_increment":$"/root/GameSettings".ball_speed_increment + }, + "player_one":{ + "length":$"/root/GameSettings".player_one_length, + "speed":$"/root/GameSettings".player_one_speed + }, + "player_two":{ + "length":$"/root/GameSettings".player_two_length, + "speed":$"/root/GameSettings".player_two_speed + } + } + var file + file = File.new() + file.open(path, File.WRITE) + file.store_line(to_json(data)) + file.close() + +func reset_data(): + data = default_data.duplicate(true) + update_settings() + +func update_settings(): + game_playtime_per_step = str(data["game"]["playtime_per_step"]) + game_wins_to_reset = str(data["game"]["wins_to_reset"]) + game_port= str(data["game"]["port"]) + + image_format = data["image"]["format"] + image_heigth = str(data["image"]["height"]) + image_width = str(data["image"]["width"]) + + trainer_ip = data["trainer"]["ip"] + trainer_port = str(data["trainer"]["port"]) + trainer_position = data["trainer"]["position"] + + + ball_height = str(data["ball"]["height"]) + ball_width = str(data["ball"]["width"]) + ball_speed_min = str(data["ball"]["speed_min"]) + ball_speed_max = str(data["ball"]["speed_max"]) + ball_speed_increment = str(data["ball"]["speed_increment"]) + + player_one_length = str(data["player_one"]["length"]) + player_one_speed = str(data["player_one"]["speed"]) + + player_two_length = str(data["player_two"]["length"]) + player_two_speed = str(data["player_two"]["speed"]) + + diff --git a/Battle Pong/GameSettings.tscn b/Battle Pong/GameSettings.tscn new file mode 100644 index 0000000000000000000000000000000000000000..efa62e8cca79ffae20ce8ca542669a1e814ae9bc --- /dev/null +++ b/Battle Pong/GameSettings.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://GameSettings.gd" type="Script" id=1] + +[node name="Node" type="Node"] +script = ExtResource( 1 ) diff --git a/Battle Pong/Main.gd b/Battle Pong/Main.gd index 0eadd60ed6a5ca2b7c9da93d72e271ea04461da9..e6331942ebf67d085db8e2f5518602f2e64b3ca5 100644 --- a/Battle Pong/Main.gd +++ b/Battle Pong/Main.gd @@ -28,11 +28,16 @@ const P1_WIN = "Player 1 won!" const P2_WIN = "Player 2 won!" var message = SPACE_TO_PLAY -export var enable_rendering = true -export var learn_with_images = true -export var playtime_per_step = 0.1 +var enable_rendering = true +var learn_with_images = true +var game_playtime_per_step = 0.1 +var max_wins = 21 func _ready(): + enable_rendering = $"/root/GameSettings".rendering_enabled + learn_with_images = $"/root/GameSettings".learn_with_images + game_playtime_per_step = $"/root/GameSettings".game_playtime_per_step + max_wins = $"/root/GameSettings".game_wins_to_reset if not enable_rendering: VisualServer.render_loop_enabled = false # disable rendering to create a massive boost if learn_with_images: @@ -148,7 +153,7 @@ func reset_paddle_positions(): func handle_game_end(): if game_done: - if score_player_one == 5: + if score_player_one >= max_wins: message = P1_WIN else: message = P2_WIN @@ -251,9 +256,9 @@ func _on_data(id): pass if(next_step_player_one and next_step_player_two): unpause() - $PlayerOne.run(playtime_per_step) - $PlayerTwo.run(playtime_per_step) - ball.run(playtime_per_step) + $PlayerOne.run(game_playtime_per_step) + $PlayerTwo.run(game_playtime_per_step) + ball.run(game_playtime_per_step) timeout() func get_observarion(): diff --git a/Battle Pong/MainMenu.gd b/Battle Pong/MainMenu.gd index 184f2ced780e205641f1cc45c176f127375e31d3..f879f3ee688cb0d2c7148f2ec925050d9e5b08c5 100644 --- a/Battle Pong/MainMenu.gd +++ b/Battle Pong/MainMenu.gd @@ -1,6 +1,5 @@ extends Control -var rendering_enabled = false # Called when the node enters the scene tree for the first time. func _ready(): @@ -17,22 +16,45 @@ func _on_but_local_two_player_pressed(): func _on_but_two_re_with_images_pressed(): + $"/root/GameSettings".rendering_enabled = true + $"/root/GameSettings".learn_with_images = true + get_tree().change_scene("res://Main.tscn") pass # Replace with function body. func _on_but_two_re_with_position_pressed(): + $"/root/GameSettings".rendering_enabled = $vbox_two_learner/HBoxContainer/cb_rendering_enabled.is_pressed() + $"/root/GameSettings".learn_with_images = false + if not $"/root/GameSettings".rendering_enabled: + $vbox_two_learner.hide() + $lbl_game_running.show() + get_viewport().set_clear_mode(Viewport.CLEAR_MODE_ONLY_NEXT_FRAME) + # Wait until the frame has finished before getting the texture. + yield(VisualServer, "frame_post_draw") + print("Rendering is disabled") + get_tree().change_scene("res://Main.tscn") pass # Replace with function body. func _on_cb_rendering_enabled_pressed(): - rendering_enabled = not rendering_enabled - print(rendering_enabled) + $"/root/GameSettings".rendering_enabled = $vbox_two_learner/HBoxContainer/cb_rendering_enabled.is_pressed() + if not $"/root/GameSettings".rendering_enabled: + $vbox_two_learner.hide() + else: + $lbl_game_running.show() + print($"/root/GameSettings".rendering_enabled) pass # Replace with function body. func _on_but_trainer_with_images_pressed(): + pass # Replace with function body. func _on_but_trainer_with_position_pressed(): pass # Replace with function body. + + +func _on_but_settings_pressed(): + get_tree().change_scene("res://SettingsWindow.tscn") + pass # Replace with function body. diff --git a/Battle Pong/MainMenu.tscn b/Battle Pong/MainMenu.tscn index 7ad934030f63f71a0b5e07d3c49b82caf25724aa..7ef8da7138ab32e18292725bc02266e405cbd1f9 100644 --- a/Battle Pong/MainMenu.tscn +++ b/Battle Pong/MainMenu.tscn @@ -14,6 +14,7 @@ __meta__ = { anchor_left = 0.5 anchor_right = 0.5 margin_left = -75.5 +margin_top = 20.0 margin_right = 75.5 margin_bottom = 14.0 text = "Battle Pong" @@ -86,9 +87,29 @@ margin_top = 116.0 margin_right = 265.0 margin_bottom = 136.0 text = "RE Trainer with Position" + +[node name="but_settings" type="Button" parent="vbox_two_learner"] +margin_top = 140.0 +margin_right = 265.0 +margin_bottom = 160.0 +text = "Settings" + +[node name="lbl_game_running" type="Label" parent="."] +visible = false +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -93.5 +margin_top = 59.0 +margin_right = 93.5 +margin_bottom = 73.0 +text = "Game runs without rendering" +__meta__ = { +"_edit_use_anchors_": false +} [connection signal="pressed" from="vbox_two_learner/but_local_two_player" to="." method="_on_but_local_two_player_pressed"] [connection signal="pressed" from="vbox_two_learner/but_two_re_with_images" to="." method="_on_but_two_re_with_images_pressed"] [connection signal="pressed" from="vbox_two_learner/HBoxContainer/but_two_re_with_position" to="." method="_on_but_two_re_with_position_pressed"] [connection signal="pressed" from="vbox_two_learner/HBoxContainer/cb_rendering_enabled" to="." method="_on_cb_rendering_enabled_pressed"] [connection signal="pressed" from="vbox_two_learner/but_trainer_with_images" to="." method="_on_but_trainer_with_images_pressed"] [connection signal="pressed" from="vbox_two_learner/but_trainer_with_position" to="." method="_on_but_trainer_with_position_pressed"] +[connection signal="pressed" from="vbox_two_learner/but_settings" to="." method="_on_but_settings_pressed"] diff --git a/Battle Pong/SettingsWindow.gd b/Battle Pong/SettingsWindow.gd new file mode 100644 index 0000000000000000000000000000000000000000..2b23516f288f03535963e48e04a21c16588f8d83 --- /dev/null +++ b/Battle Pong/SettingsWindow.gd @@ -0,0 +1,97 @@ +extends Control + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" + + + +# Called when the node enters the scene tree for the first time. +func _ready(): + update_gui() + + +func update_gui(): + $VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings/input_game_playtime_per_step.text = str($"/root/GameSettings".game_playtime_per_step) + $VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings/input_game_wins_to_reset.text = str($"/root/GameSettings".game_wins_to_reset) + $VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings/input_game_port.text= str($"/root/GameSettings".game_port) + + $VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings/input_image_format.text = $"/root/GameSettings".image_format + $VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings/input_image_height.text = str($"/root/GameSettings".image_heigth) + $VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings/input_image_width.text = str($"/root/GameSettings".image_width) + + $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_ip.text = $"/root/GameSettings".trainer_ip + $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_port.text = str($"/root/GameSettings".trainer_port) + if $"/root/GameSettings".trainer_position =="Left": + $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position.pressed = false + elif $"/root/GameSettings".trainer_position =="Right": + $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position.pressed = true + + $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position.text = $"/root/GameSettings".trainer_position + + + $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_height.text = str($"/root/GameSettings".ball_height) + $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_width.text = str($"/root/GameSettings".ball_width) + $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_speed_min.text = str($"/root/GameSettings".ball_speed_min) + $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_speed_max.text = str($"/root/GameSettings".ball_speed_max) + $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_speed_increment.text = str($"/root/GameSettings".ball_speed_increment) + + $VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings/input_player_one_length.text = str($"/root/GameSettings".player_one_length) + $VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings/input_player_one_speed.text = str($"/root/GameSettings".player_one_speed) + + $VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings/input_player_two_length.text = str($"/root/GameSettings".player_two_length) + $VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings/input_player_two_speed.text = str($"/root/GameSettings".player_two_speed) + + +func _on_input_trainer_position_pressed(): + if $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position.is_pressed(): + $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position.text = "Right" + else: + $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position.text = "Left" + pass # Replace with function body. + + +func _on_but_save_pressed(): + $"/root/GameSettings".game_playtime_per_step = $VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings/input_game_playtime_per_step.text as float + $"/root/GameSettings".game_wins_to_reset = $VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings/input_game_wins_to_reset.text as int + $"/root/GameSettings".game_port = $VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings/input_game_port.text as int + + $"/root/GameSettings".image_format = $VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings/input_image_format.text + $"/root/GameSettings".image_heigth = $VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings/input_image_height.text as int + $"/root/GameSettings".image_width = $VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings/input_image_width.text as int + + $"/root/GameSettings".trainer_ip = $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_ip.text + $"/root/GameSettings".trainer_port = $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_port.text as int + $"/root/GameSettings".trainer_position = $VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position.text + + $"/root/GameSettings".ball_height = $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_height.text as int + $"/root/GameSettings".ball_width = $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_width.text as int + $"/root/GameSettings".ball_speed_min = $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_speed_min.text as int + $"/root/GameSettings".ball_speed_max = $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_speed_max.text as int + $"/root/GameSettings".ball_speed_increment = $VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings/input_ball_speed_increment.text as int + + $"/root/GameSettings".player_one_length = $VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings/input_player_one_length.text as int + $"/root/GameSettings".player_one_speed = $VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings/input_player_one_speed.text as int + + $"/root/GameSettings".player_two_length = $VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings/input_player_two_length.text as int + $"/root/GameSettings".player_two_speed = $VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings/input_player_two_speed.text as int + + $"/root/GameSettings".save_data() + + print("new values") + print($"/root/GameSettings".data) + + get_tree().change_scene("res://MainMenu.tscn") + pass # Replace with function body. + + +func _on_but_reset_pressed(): + $"/root/GameSettings".reset_data() + update_gui() + pass # Replace with function body. + + +func _on_but_cancel_pressed(): + get_tree().change_scene("res://MainMenu.tscn") + pass # Replace with function body. diff --git a/Battle Pong/SettingsWindow.tscn b/Battle Pong/SettingsWindow.tscn new file mode 100644 index 0000000000000000000000000000000000000000..d19e3b1032907c6a14fd5b6e867cae7daa5d1c79 --- /dev/null +++ b/Battle Pong/SettingsWindow.tscn @@ -0,0 +1,435 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://SettingsWindow.gd" type="Script" id=1] + +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource( 1 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="lbl_title" type="Label" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -46.5 +margin_top = 20.0 +margin_right = 46.5 +margin_bottom = 14.0 +text = "Game Settings" +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -141.5 +margin_top = -181.0 +margin_right = 141.5 +margin_bottom = 181.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="grid_settings" type="GridContainer" parent="VBoxContainer"] +margin_right = 344.0 +margin_bottom = 353.0 +columns = 3 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="vbox_game_settings" type="VBoxContainer" parent="VBoxContainer/grid_settings"] +margin_right = 160.0 +margin_bottom = 105.0 + +[node name="lbl_title_game_settings" type="Label" parent="VBoxContainer/grid_settings/vbox_game_settings"] +margin_right = 160.0 +margin_bottom = 14.0 +text = "Game:" + +[node name="grid_game_settings" type="GridContainer" parent="VBoxContainer/grid_settings/vbox_game_settings"] +margin_top = 18.0 +margin_right = 160.0 +margin_bottom = 105.0 +columns = 2 + +[node name="lbl_game_playtime_per_step" type="Label" parent="VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings"] +margin_right = 89.0 +margin_bottom = 31.0 +text = "Playtime/Step +(Seconds)" + +[node name="input_game_playtime_per_step" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings"] +margin_left = 93.0 +margin_right = 151.0 +margin_bottom = 31.0 + +[node name="lbl_game_wins_to_reset" type="Label" parent="VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings"] +margin_top = 40.0 +margin_right = 89.0 +margin_bottom = 54.0 +text = "Wins till end" + +[node name="input_game_wins_to_reset" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings"] +margin_left = 93.0 +margin_top = 35.0 +margin_right = 151.0 +margin_bottom = 59.0 +align = 2 + +[node name="lbl_game_port" type="Label" parent="VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings"] +margin_top = 68.0 +margin_right = 89.0 +margin_bottom = 82.0 +text = "Port" + +[node name="input_game_port" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_game_settings/grid_game_settings"] +margin_left = 93.0 +margin_top = 63.0 +margin_right = 151.0 +margin_bottom = 87.0 + +[node name="VSeparator" type="VSeparator" parent="VBoxContainer/grid_settings"] +margin_left = 164.0 +margin_right = 168.0 +margin_bottom = 105.0 + +[node name="vbox_image_settings" type="VBoxContainer" parent="VBoxContainer/grid_settings"] +margin_left = 172.0 +margin_right = 344.0 +margin_bottom = 105.0 + +[node name="lbl_title_image_settings" type="Label" parent="VBoxContainer/grid_settings/vbox_image_settings"] +margin_right = 172.0 +margin_bottom = 14.0 +text = "Image:" + +[node name="grid_image_settings" type="GridContainer" parent="VBoxContainer/grid_settings/vbox_image_settings"] +margin_top = 18.0 +margin_right = 172.0 +margin_bottom = 98.0 +columns = 2 + +[node name="lbl_image_format" type="Label" parent="VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings"] +margin_top = 5.0 +margin_right = 45.0 +margin_bottom = 19.0 +text = "Format" + +[node name="input_image_format" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings"] +margin_left = 49.0 +margin_right = 107.0 +margin_bottom = 24.0 +hint_tooltip = "example: +RGB8 +L8 +https://docs.godotengine.org/en/stable/classes/class_image.html#enumerations" + +[node name="lbl_image_heigth" type="Label" parent="VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings"] +margin_top = 33.0 +margin_right = 45.0 +margin_bottom = 47.0 +text = "Height" + +[node name="input_image_height" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings"] +margin_left = 49.0 +margin_top = 28.0 +margin_right = 107.0 +margin_bottom = 52.0 + +[node name="lbl_image_width" type="Label" parent="VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings"] +margin_top = 61.0 +margin_right = 45.0 +margin_bottom = 75.0 +text = "Width" + +[node name="input_image_width" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_image_settings/grid_image_settings"] +margin_left = 49.0 +margin_top = 56.0 +margin_right = 107.0 +margin_bottom = 80.0 + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/grid_settings"] +margin_top = 109.0 +margin_right = 160.0 +margin_bottom = 113.0 + +[node name="HSeparator6" type="HSeparator" parent="VBoxContainer/grid_settings"] +margin_left = 164.0 +margin_top = 109.0 +margin_right = 168.0 +margin_bottom = 113.0 + +[node name="HSeparator5" type="HSeparator" parent="VBoxContainer/grid_settings"] +margin_left = 172.0 +margin_top = 109.0 +margin_right = 344.0 +margin_bottom = 113.0 + +[node name="vbox_trainer_settings" type="VBoxContainer" parent="VBoxContainer/grid_settings"] +margin_top = 117.0 +margin_right = 160.0 +margin_bottom = 271.0 + +[node name="lbl_title_trainer_settings" type="Label" parent="VBoxContainer/grid_settings/vbox_trainer_settings"] +margin_right = 160.0 +margin_bottom = 14.0 +text = "Trainer:" + +[node name="grid_trainer_settings" type="GridContainer" parent="VBoxContainer/grid_settings/vbox_trainer_settings"] +margin_top = 18.0 +margin_right = 160.0 +margin_bottom = 114.0 +columns = 2 + +[node name="lbl_trainer_ip" type="Label" parent="VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings"] +margin_top = 5.0 +margin_right = 52.0 +margin_bottom = 19.0 +text = "IP" + +[node name="input_trainer_ip" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings"] +margin_left = 56.0 +margin_right = 160.0 +margin_bottom = 24.0 + +[node name="lbl_trainer_port" type="Label" parent="VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings"] +margin_top = 33.0 +margin_right = 52.0 +margin_bottom = 47.0 +text = "Port" + +[node name="input_trainer_port" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings"] +margin_left = 56.0 +margin_top = 28.0 +margin_right = 160.0 +margin_bottom = 52.0 + +[node name="lbl_trainer_position" type="Label" parent="VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings"] +margin_top = 69.0 +margin_right = 52.0 +margin_bottom = 83.0 +text = "Position" + +[node name="input_trainer_position" type="CheckButton" parent="VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings"] +margin_left = 56.0 +margin_top = 56.0 +margin_right = 160.0 +margin_bottom = 96.0 +text = "Left" + +[node name="VSeparator2" type="VSeparator" parent="VBoxContainer/grid_settings"] +margin_left = 164.0 +margin_top = 117.0 +margin_right = 168.0 +margin_bottom = 271.0 + +[node name="vbox_ball_settings" type="VBoxContainer" parent="VBoxContainer/grid_settings"] +margin_left = 172.0 +margin_top = 117.0 +margin_right = 344.0 +margin_bottom = 271.0 + +[node name="lbl_title_ball_settings" type="Label" parent="VBoxContainer/grid_settings/vbox_ball_settings"] +margin_right = 172.0 +margin_bottom = 14.0 +text = "Ball:" + +[node name="grid_ball_settings" type="GridContainer" parent="VBoxContainer/grid_settings/vbox_ball_settings"] +margin_top = 18.0 +margin_right = 172.0 +margin_bottom = 154.0 +columns = 2 + +[node name="lbl_ball_height" type="Label" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_top = 5.0 +margin_right = 110.0 +margin_bottom = 19.0 +text = "Hight" + +[node name="input_ball_height" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_left = 114.0 +margin_right = 172.0 +margin_bottom = 24.0 + +[node name="lbl_ball_width" type="Label" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_top = 33.0 +margin_right = 110.0 +margin_bottom = 47.0 +text = "Width" + +[node name="input_ball_width" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_left = 114.0 +margin_top = 28.0 +margin_right = 172.0 +margin_bottom = 52.0 + +[node name="lbl_ball_speed_min" type="Label" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_top = 61.0 +margin_right = 110.0 +margin_bottom = 75.0 +text = "Speed Min" + +[node name="input_ball_speed_min" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_left = 114.0 +margin_top = 56.0 +margin_right = 172.0 +margin_bottom = 80.0 + +[node name="lbl_ball_speed_max" type="Label" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_top = 89.0 +margin_right = 110.0 +margin_bottom = 103.0 +text = "Speed Max" + +[node name="input_ball_speed_max" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_left = 114.0 +margin_top = 84.0 +margin_right = 172.0 +margin_bottom = 108.0 + +[node name="lbl_ball_speed_increment" type="Label" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_top = 117.0 +margin_right = 110.0 +margin_bottom = 131.0 +text = "Speed Increment" + +[node name="input_ball_speed_increment" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_ball_settings/grid_ball_settings"] +margin_left = 114.0 +margin_top = 112.0 +margin_right = 172.0 +margin_bottom = 136.0 + +[node name="HSeparator7" type="HSeparator" parent="VBoxContainer/grid_settings"] +margin_top = 275.0 +margin_right = 160.0 +margin_bottom = 279.0 + +[node name="VSeparator3" type="HSeparator" parent="VBoxContainer/grid_settings"] +margin_left = 164.0 +margin_top = 275.0 +margin_right = 168.0 +margin_bottom = 279.0 + +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/grid_settings"] +margin_left = 172.0 +margin_top = 275.0 +margin_right = 344.0 +margin_bottom = 279.0 + +[node name="vbox_player_one_settings" type="VBoxContainer" parent="VBoxContainer/grid_settings"] +margin_top = 283.0 +margin_right = 160.0 +margin_bottom = 353.0 + +[node name="lbl_title_player_one_settings" type="Label" parent="VBoxContainer/grid_settings/vbox_player_one_settings"] +margin_right = 160.0 +margin_bottom = 14.0 +text = "Player 1:" + +[node name="grid_player_one_settings" type="GridContainer" parent="VBoxContainer/grid_settings/vbox_player_one_settings"] +margin_top = 18.0 +margin_right = 160.0 +margin_bottom = 70.0 +columns = 2 + +[node name="lbl_player_one_length" type="Label" parent="VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings"] +margin_top = 5.0 +margin_right = 43.0 +margin_bottom = 19.0 +text = "Length" + +[node name="input_player_one_length" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings"] +margin_left = 47.0 +margin_right = 105.0 +margin_bottom = 24.0 + +[node name="lbl_player_one_speed" type="Label" parent="VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings"] +margin_top = 33.0 +margin_right = 43.0 +margin_bottom = 47.0 +text = "Speed" + +[node name="input_player_one_speed" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_player_one_settings/grid_player_one_settings"] +margin_left = 47.0 +margin_top = 28.0 +margin_right = 105.0 +margin_bottom = 52.0 + +[node name="VSeparator4" type="VSeparator" parent="VBoxContainer/grid_settings"] +margin_left = 164.0 +margin_top = 283.0 +margin_right = 168.0 +margin_bottom = 353.0 + +[node name="vbox_player_two_settings" type="VBoxContainer" parent="VBoxContainer/grid_settings"] +margin_left = 172.0 +margin_top = 283.0 +margin_right = 344.0 +margin_bottom = 353.0 + +[node name="lbl_title_player_two_settings" type="Label" parent="VBoxContainer/grid_settings/vbox_player_two_settings"] +margin_right = 172.0 +margin_bottom = 14.0 +text = "Player 2:" + +[node name="grid_player_two_settings" type="GridContainer" parent="VBoxContainer/grid_settings/vbox_player_two_settings"] +margin_top = 18.0 +margin_right = 172.0 +margin_bottom = 70.0 +columns = 2 + +[node name="lbl_player_two_length" type="Label" parent="VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings"] +margin_top = 5.0 +margin_right = 43.0 +margin_bottom = 19.0 +text = "Length" + +[node name="input_player_two_length" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings"] +margin_left = 47.0 +margin_right = 105.0 +margin_bottom = 24.0 + +[node name="lbl_player_two_speed" type="Label" parent="VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings"] +margin_top = 33.0 +margin_right = 43.0 +margin_bottom = 47.0 +text = "Speed" + +[node name="input_player_two_speed" type="LineEdit" parent="VBoxContainer/grid_settings/vbox_player_two_settings/grid_player_two_settings"] +margin_left = 47.0 +margin_top = 28.0 +margin_right = 105.0 +margin_bottom = 52.0 + +[node name="VSeparator5" type="HSeparator" parent="VBoxContainer"] +margin_top = 357.0 +margin_right = 344.0 +margin_bottom = 361.0 + +[node name="but_save" type="Button" parent="VBoxContainer"] +margin_top = 365.0 +margin_right = 344.0 +margin_bottom = 385.0 +text = "Save" + +[node name="but_cancel" type="Button" parent="VBoxContainer"] +margin_top = 389.0 +margin_right = 344.0 +margin_bottom = 409.0 +text = "Cancel" + +[node name="but_reset" type="Button" parent="VBoxContainer"] +margin_top = 413.0 +margin_right = 344.0 +margin_bottom = 433.0 +text = "Reset" +[connection signal="pressed" from="VBoxContainer/grid_settings/vbox_trainer_settings/grid_trainer_settings/input_trainer_position" to="." method="_on_input_trainer_position_pressed"] +[connection signal="pressed" from="VBoxContainer/but_save" to="." method="_on_but_save_pressed"] +[connection signal="pressed" from="VBoxContainer/but_cancel" to="." method="_on_but_cancel_pressed"] +[connection signal="pressed" from="VBoxContainer/but_reset" to="." method="_on_but_reset_pressed"] diff --git a/Battle Pong/project.godot b/Battle Pong/project.godot index e02a4732000668ff8c3cac80538bab7bf567fd7f..b008c916c34acf2d874e69bf063e1e975be65278 100644 --- a/Battle Pong/project.godot +++ b/Battle Pong/project.godot @@ -16,9 +16,13 @@ _global_script_class_icons={ [application] config/name="Battle Pong" -run/main_scene="res://Main.tscn" +run/main_scene="res://MainMenu.tscn" config/icon="res://icon.png" +[autoload] + +GameSettings="*res://GameSettings.gd" + [debug] settings/gdscript/max_call_stack=4096