diff --git a/godot_ship/project.godot b/godot_ship/project.godot index 53d1401..2613626 100644 --- a/godot_ship/project.godot +++ b/godot_ship/project.godot @@ -20,6 +20,42 @@ window/size/width=640 window/size/height=360 window/per_pixel_transparency/allowed=true +[input] + +ui_left={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"unicode":0,"echo":false,"script":null) + ] +} +ui_right={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"unicode":0,"echo":false,"script":null) + ] +} +ui_up={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"unicode":0,"echo":false,"script":null) + ] +} +ui_down={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"unicode":0,"echo":false,"script":null) + ] +} +ui_debug={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":96,"unicode":0,"echo":false,"script":null) + ] +} + [physics] common/enable_pause_aware_picking=true diff --git a/godot_ship/scenes/Debug Menu.tscn b/godot_ship/scenes/Debug Menu.tscn index 3076839..649c367 100644 --- a/godot_ship/scenes/Debug Menu.tscn +++ b/godot_ship/scenes/Debug Menu.tscn @@ -6,28 +6,36 @@ [node name="Debug" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 +margin_top = -360.0 +margin_bottom = -360.0 theme = ExtResource( 1 ) script = ExtResource( 2 ) __meta__ = { "_edit_use_anchors_": false } -[node name="VBoxContainer" type="VBoxContainer" parent="."] +[node name="debug_canvas" type="CanvasLayer" parent="."] +layer = 69 +offset = Vector2( 0, -360 ) +transform = Transform2D( 1, 0, 0, 1, 0, -360 ) + +[node name="VBoxContainer" type="VBoxContainer" parent="debug_canvas"] anchor_right = 1.0 anchor_bottom = 1.0 +margin_bottom = -180.0 custom_constants/separation = 2 __meta__ = { "_edit_use_anchors_": false } -[node name="TextEdit" type="TextEdit" parent="VBoxContainer"] +[node name="TextEdit" type="TextEdit" parent="debug_canvas/VBoxContainer"] margin_right = 640.0 margin_bottom = 144.0 rect_min_size = Vector2( 0, 144 ) text = "Turn 0 Player 1: 0 ships, 0 hits, 0 misses" -[node name="LineEdit" type="LineEdit" parent="VBoxContainer"] +[node name="LineEdit" type="LineEdit" parent="debug_canvas/VBoxContainer"] margin_top = 146.0 margin_right = 640.0 margin_bottom = 170.0 diff --git a/godot_ship/scenes/Main.tscn b/godot_ship/scenes/Main.tscn index bd41ee5..3dd2b98 100644 --- a/godot_ship/scenes/Main.tscn +++ b/godot_ship/scenes/Main.tscn @@ -1,8 +1,21 @@ -[gd_scene format=2] +[gd_scene load_steps=5 format=2] -[node name="Control" type="Control"] +[ext_resource path="res://scenes/Debug Menu.tscn" type="PackedScene" id=1] +[ext_resource path="res://scenes/Gameplay.tscn" type="PackedScene" id=2] +[ext_resource path="res://scenes/Title Screen.tscn" type="PackedScene" id=3] +[ext_resource path="res://scenes/Options.tscn" type="PackedScene" id=4] + +[node name="Root" type="Control"] anchor_right = 1.0 anchor_bottom = 1.0 __meta__ = { "_edit_use_anchors_": false } + +[node name="Title Screen" parent="." instance=ExtResource( 3 )] + +[node name="Game" parent="." instance=ExtResource( 2 )] + +[node name="Options" parent="." instance=ExtResource( 4 )] + +[node name="Debug Menu" parent="." instance=ExtResource( 1 )] diff --git a/godot_ship/scenes/MultiplayerController.tscn b/godot_ship/scenes/MultiplayerController.tscn new file mode 100644 index 0000000..d39d64e --- /dev/null +++ b/godot_ship/scenes/MultiplayerController.tscn @@ -0,0 +1,6 @@ +[gd_scene format=2] + +[node name="Control" type="Control"] +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/godot_ship/script/debug/debug_menu.gd b/godot_ship/script/debug/debug_menu.gd index bb9bd06..926cc8d 100644 --- a/godot_ship/script/debug/debug_menu.gd +++ b/godot_ship/script/debug/debug_menu.gd @@ -1,16 +1,35 @@ extends Control +# Declare member variables here. +var debug_canvas +var debug_transform -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +var debug_active = false +var menu_position = 0.0 +var menu_velocity = 2 +# positions when the menu is hidden/active +var menu_hidden = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0,-180)) +var menu_active = Transform2D(Vector2(1,0), Vector2(0,1), Vector2(0, 0)) # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. - + debug_canvas = get_node("debug_canvas") + debug_transform = debug_canvas.get_transform() + return # Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass +func _process(delta): + if (debug_active && menu_position < 1): + menu_position += menu_velocity * delta; + elif (!debug_active && menu_position > 0): + menu_position -= menu_velocity * delta; + else: + menu_position = round(menu_position) + + debug_canvas.set_transform(menu_hidden.interpolate_with(menu_active, menu_position)) + +func _unhandled_input(event): + if event.is_action_pressed("ui_debug"): + # open debug menu + debug_active = !debug_active;