From 97784eb24e8483ec79664093c08e3b11e52454f7 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Tue, 7 Jul 2020 00:00:39 +0200 Subject: [PATCH] Change UI style for computers --- Actors/Objects/Computer/Computer.gd | 12 +++ Actors/Objects/Computer/Computer.tscn | 15 +++- Actors/Objects/Computer/UI/ControlComp.gd | 12 +++ Actors/Objects/Computer/UI/ControlComp.tscn | 86 +++++++++++++++++++++ Classes/UICommand.gd | 11 +++ Scenes/Game.gd | 16 ++++ Scenes/{Test.tscn => Game.tscn} | 20 ++++- Scenes/Map.gd | 20 ++++- Scenes/Maps/odyssey.tscn | 2 +- Scenes/UI.gd | 5 ++ Scenes/World.gd | 2 + Scenes/ui.tscn | 8 ++ project.godot | 28 ++++++- 13 files changed, 229 insertions(+), 8 deletions(-) create mode 100644 Actors/Objects/Computer/UI/ControlComp.gd create mode 100644 Actors/Objects/Computer/UI/ControlComp.tscn create mode 100644 Classes/UICommand.gd create mode 100644 Scenes/Game.gd rename Scenes/{Test.tscn => Game.tscn} (51%) create mode 100644 Scenes/UI.gd create mode 100644 Scenes/ui.tscn diff --git a/Actors/Objects/Computer/Computer.gd b/Actors/Objects/Computer/Computer.gd index 852996f..5057454 100644 --- a/Actors/Objects/Computer/Computer.gd +++ b/Actors/Objects/Computer/Computer.gd @@ -43,3 +43,15 @@ func set_direction(dir): Direction.RIGHT: $computer.region_rect.position = Vector2(32, 0) $computer/screen.region_rect.position = screen_region_offset + Vector2(64, 0) + +func open_controls(): + match computer_type: + ComputerType.ShipCommand: + $Control/ControlComp.visible = true + +func _input_event(viewport, event, shape_idx): + if Engine.editor_hint: + return + if event is InputEventMouseButton and event.pressed: + print(event) + open_controls() diff --git a/Actors/Objects/Computer/Computer.tscn b/Actors/Objects/Computer/Computer.tscn index 6e97c87..0902b82 100644 --- a/Actors/Objects/Computer/Computer.tscn +++ b/Actors/Objects/Computer/Computer.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=7 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://Graphics/tgstation/computer-screens.png" type="Texture" id=1] [ext_resource path="res://Graphics/tgstation/computer.png" type="Texture" id=2] [ext_resource path="res://Actors/Objects/Computer/Computer.gd" type="Script" id=3] +[ext_resource path="res://Actors/Objects/Computer/UI/ControlComp.tscn" type="PackedScene" id=4] [sub_resource type="RectangleShape2D" id=1] extents = Vector2( 16, 16 ) @@ -41,6 +42,7 @@ tracks/0/keys = { } [node name="Computer" type="StaticBody2D"] +input_pickable = true script = ExtResource( 3 ) [node name="computer" type="Sprite" parent="."] @@ -63,3 +65,14 @@ shape = SubResource( 1 ) autoplay = "on" anims/off = SubResource( 2 ) anims/on = SubResource( 3 ) + +[node name="Control" type="Node2D" parent="."] +z_index = 999 + +[node name="ControlComp" parent="Control" instance=ExtResource( 4 )] +visible = false +margin_left = -33.1487 +margin_top = -78.3109 +margin_right = 166.851 +margin_bottom = 53.6891 +rect_scale = Vector2( 0.5, 0.5 ) diff --git a/Actors/Objects/Computer/UI/ControlComp.gd b/Actors/Objects/Computer/UI/ControlComp.gd new file mode 100644 index 0000000..29caefd --- /dev/null +++ b/Actors/Objects/Computer/UI/ControlComp.gd @@ -0,0 +1,12 @@ +extends Control + +onready var scene = $"/root/scene" as GameInstance + +func _ready(): + pass + +func _ship_velocity_changed(value): + scene.process_command(UICommand.new(UICommand.CommandType.SetShipSpeed, [value])) + +func _ship_direction_changed(value): + scene.process_command(UICommand.new(UICommand.CommandType.SetShipDirection, [deg2rad(value)])) diff --git a/Actors/Objects/Computer/UI/ControlComp.tscn b/Actors/Objects/Computer/UI/ControlComp.tscn new file mode 100644 index 0000000..ac3de95 --- /dev/null +++ b/Actors/Objects/Computer/UI/ControlComp.tscn @@ -0,0 +1,86 @@ +[gd_scene load_steps=2 format=2] + +[ext_resource path="res://Actors/Objects/Computer/UI/ControlComp.gd" type="Script" id=1] + +[node name="ControlComp" type="Panel"] +margin_left = -100.0 +margin_top = -150.0 +margin_right = 100.0 +margin_bottom = -20.0 +script = ExtResource( 1 ) + +[node name="Panel" type="Panel" parent="."] +margin_left = 100.0 +margin_top = 90.0 +margin_right = 140.0 +margin_bottom = 130.0 +rect_rotation = 45.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Container" type="VBoxContainer" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 10.0 +margin_top = 10.0 +margin_right = -10.0 +margin_bottom = -10.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +custom_constants/separation = 20 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="VelocityBox" type="VBoxContainer" parent="Container"] +margin_right = 180.0 +margin_bottom = 45.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +alignment = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ShipVelocityLabel" type="Label" parent="Container/VelocityBox"] +margin_top = 5.0 +margin_right = 180.0 +margin_bottom = 19.0 +text = "Ship velocity" + +[node name="HSlider" type="HSlider" parent="Container/VelocityBox"] +margin_top = 23.0 +margin_right = 180.0 +margin_bottom = 39.0 +max_value = 1000.0 +value = 1000.0 +tick_count = 10 +ticks_on_borders = true + +[node name="DirectionBox" type="VBoxContainer" parent="Container"] +margin_top = 65.0 +margin_right = 180.0 +margin_bottom = 110.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +alignment = 1 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="ShipDirectionLabel" type="Label" parent="Container/DirectionBox"] +margin_top = 5.0 +margin_right = 180.0 +margin_bottom = 19.0 +text = "Ship direction" + +[node name="HSlider" type="HSlider" parent="Container/DirectionBox"] +margin_top = 23.0 +margin_right = 180.0 +margin_bottom = 39.0 +max_value = 360.0 +tick_count = 18 +ticks_on_borders = true +[connection signal="value_changed" from="Container/VelocityBox/HSlider" to="." method="_ship_velocity_changed"] +[connection signal="value_changed" from="Container/DirectionBox/HSlider" to="." method="_ship_direction_changed"] diff --git a/Classes/UICommand.gd b/Classes/UICommand.gd new file mode 100644 index 0000000..1be6e13 --- /dev/null +++ b/Classes/UICommand.gd @@ -0,0 +1,11 @@ +class_name UICommand + +enum CommandType { + SetShipSpeed, + SetShipDirection +} +var cmd_type = null +var cmd_args = [] +func _init(_type, _args): + cmd_type = _type + cmd_args = _args diff --git a/Scenes/Game.gd b/Scenes/Game.gd new file mode 100644 index 0000000..25e265a --- /dev/null +++ b/Scenes/Game.gd @@ -0,0 +1,16 @@ +extends Node + +class_name GameInstance + +onready var ui = $CanvasLayer/ui as GameUI +onready var world = $world as GameWorld + +func _ready(): + ui.connect("command", world, "process_command") + +func process_command(cmd: UICommand): + match cmd.cmd_type: + UICommand.CommandType.SetShipSpeed: + world.map.ship_speed = cmd.cmd_args[0] + UICommand.CommandType.SetShipDirection: + world.map.ship_direction = cmd.cmd_args[0] diff --git a/Scenes/Test.tscn b/Scenes/Game.tscn similarity index 51% rename from Scenes/Test.tscn rename to Scenes/Game.tscn index 132f4c0..f6654ea 100644 --- a/Scenes/Test.tscn +++ b/Scenes/Game.tscn @@ -1,10 +1,14 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://Scenes/Maps/odyssey.tscn" type="PackedScene" id=1] [ext_resource path="res://Actors/Player/Player.tscn" type="PackedScene" id=2] +[ext_resource path="res://Scenes/ui.tscn" type="PackedScene" id=3] [ext_resource path="res://Scenes/World.gd" type="Script" id=4] +[ext_resource path="res://Scenes/Game.gd" type="Script" id=5] +[ext_resource path="res://Scenes/UI.gd" type="Script" id=6] -[node name="scene" type="Node2D"] +[node name="scene" type="Node"] +script = ExtResource( 5 ) [node name="world" type="Node2D" parent="."] scale = Vector2( 2, 2 ) @@ -19,3 +23,15 @@ position = Vector2( 206.017, 250.966 ) z_index = 1 mapNode = NodePath("../map") is_controlled = true + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="ui" parent="CanvasLayer" instance=ExtResource( 3 )] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = 0.0 +margin_bottom = 0.0 +mouse_filter = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +script = ExtResource( 6 ) diff --git a/Scenes/Map.gd b/Scenes/Map.gd index 7baa093..03fef67 100755 --- a/Scenes/Map.gd +++ b/Scenes/Map.gd @@ -2,11 +2,27 @@ extends Node2D class_name Map -var ship_direction = Vector2.RIGHT +var ship_direction = 0 var ship_speed = 1000 +var current_ship_direction = 0 +var current_ship_speed = 0 + +const SPEED_EASE = 0.5 +const DIRECTION_EASE = 0.5 +const EPSILON = 0.01 + export(NodePath) var tilemap_path onready var tilemap = get_node(tilemap_path) as MapTiles func _process(delta): - $deepspace.region_rect.position += ship_direction * ship_speed * delta + if abs(ship_direction - current_ship_direction) < EPSILON: + current_ship_direction = ship_direction + else: + current_ship_direction = lerp(current_ship_direction, ship_direction, delta * DIRECTION_EASE) + if abs(ship_speed - current_ship_speed) < EPSILON: + current_ship_speed = ship_speed + else: + current_ship_speed = lerp(current_ship_speed, ship_speed, delta * SPEED_EASE) + $deepspace.rotation = current_ship_direction-PI/2 + $deepspace.region_rect.position += Vector2(sin(current_ship_direction), cos(current_ship_direction)) * current_ship_speed * delta diff --git a/Scenes/Maps/odyssey.tscn b/Scenes/Maps/odyssey.tscn index 7f3ebdb..dd60867 100644 --- a/Scenes/Maps/odyssey.tscn +++ b/Scenes/Maps/odyssey.tscn @@ -23,7 +23,7 @@ cell_size = Vector2( 32, 32 ) cell_quadrant_size = 32 occluder_light_mask = -2147483647 format = 1 -tile_data = PoolIntArray( 262137, 2, 0, 262138, 2, 0, 262139, 2, 0, 262140, 2, 0, 262141, 2, 0, 262142, 2, 0, 262143, 2, 0, 196608, 2, 0, 196609, 2, 0, 196610, 2, 0, 196611, 2, 0, 196612, 2, 0, 196613, 2, 0, 196614, 2, 0, 196615, 2, 0, 196616, 2, 0, 196617, 2, 0, 196618, 2, 0, 196619, 2, 0, 196620, 2, 0, 196621, 2, 0, 196622, 2, 0, 196623, 2, 0, 196624, 2, 0, 196625, 2, 0, 196626, 2, 0, 196627, 2, 0, 327673, 2, 0, 327674, 1, 0, 327675, 1, 0, 327676, 1, 0, 327677, 1, 0, 327678, 1, 0, 327679, 2, 0, 262144, 1, 0, 262145, 1, 0, 262146, 1, 0, 262147, 1, 0, 262148, 1, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 1, 0, 262153, 1, 0, 262154, 1, 0, 262155, 1, 0, 262156, 1, 0, 262157, 2, 0, 262158, 1, 0, 262159, 1, 0, 262160, 1, 0, 262161, 1, 0, 262162, 1, 0, 262163, 3, 0, 393209, 2, 0, 393210, 1, 0, 393211, 1, 0, 393212, 1, 0, 393213, 1, 0, 393214, 1, 0, 393215, 2, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 327684, 1, 0, 327685, 1, 0, 327686, 1, 0, 327687, 1, 0, 327688, 1, 0, 327689, 1, 0, 327690, 1, 0, 327691, 1, 0, 327692, 1, 0, 327693, 2, 0, 327694, 1, 0, 327695, 1, 0, 327696, 1, 0, 327697, 1, 0, 327698, 1, 0, 327699, 3, 0, 458745, 2, 0, 458746, 1, 0, 458747, 1, 0, 458748, 1, 0, 458749, 1, 0, 458750, 1, 0, 458751, 1, 0, 393216, 1, 0, 393217, 1, 0, 393218, 1, 0, 393219, 1, 0, 393220, 1, 0, 393221, 1, 0, 393222, 1, 0, 393223, 1, 0, 393224, 1, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 1, 0, 393229, 1, 0, 393230, 1, 0, 393231, 1, 0, 393232, 1, 0, 393233, 1, 0, 393234, 1, 0, 393235, 3, 0, 524281, 2, 0, 524282, 1, 0, 524283, 1, 0, 524284, 1, 0, 524285, 1, 0, 524286, 1, 0, 524287, 3, 0, 458752, 1, 0, 458753, 1, 0, 458754, 1, 0, 458755, 1, 0, 458756, 1, 0, 458757, 1, 0, 458758, 1, 0, 458759, 1, 0, 458760, 1, 0, 458761, 1, 0, 458762, 1, 0, 458763, 1, 0, 458764, 1, 0, 458765, 3, 0, 458766, 1, 0, 458767, 1, 0, 458768, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 2, 0, 589817, 2, 0, 589818, 1, 0, 589819, 1, 0, 589820, 1, 0, 589821, 1, 0, 589822, 1, 0, 589823, 3, 0, 524288, 1, 0, 524289, 1, 0, 524290, 1, 0, 524291, 1, 0, 524292, 1, 0, 524293, 1, 0, 524294, 1, 0, 524295, 1, 0, 524296, 1, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 1, 0, 524301, 3, 0, 524302, 1, 0, 524303, 1, 0, 524304, 1, 0, 524305, 1, 0, 524306, 1, 0, 524307, 2, 0, 655353, 2, 0, 655354, 1, 0, 655355, 1, 0, 655356, 1, 0, 655357, 1, 0, 655358, 1, 0, 655359, 1, 0, 589824, 1, 0, 589825, 1, 0, 589826, 1, 0, 589827, 1, 0, 589828, 1, 0, 589829, 1, 0, 589830, 1, 0, 589831, 1, 0, 589832, 1, 0, 589833, 1, 0, 589834, 1, 0, 589835, 1, 0, 589836, 1, 0, 589837, 1, 0, 589838, 1, 0, 589839, 1, 0, 589840, 1, 0, 589841, 1, 0, 589842, 1, 0, 589843, 3, 0, 720889, 2, 0, 720890, 1, 0, 720891, 1, 0, 720892, 1, 0, 720893, 1, 0, 720894, 1, 0, 720895, 2, 0, 655360, 1, 0, 655361, 1, 0, 655362, 1, 0, 655363, 1, 0, 655364, 1, 0, 655365, 1, 0, 655366, 1, 0, 655367, 1, 0, 655368, 1, 0, 655369, 1, 0, 655370, 1, 0, 655371, 1, 0, 655372, 1, 0, 655373, 2, 0, 655374, 1, 0, 655375, 1, 0, 655376, 1, 0, 655377, 1, 0, 655378, 1, 0, 655379, 3, 0, 786425, 2, 0, 786426, 1, 0, 786427, 1, 0, 786428, 1, 0, 786429, 1, 0, 786430, 1, 0, 786431, 2, 0, 720896, 1, 0, 720897, 1, 0, 720898, 1, 0, 720899, 1, 0, 720900, 1, 0, 720901, 1, 0, 720902, 1, 0, 720903, 1, 0, 720904, 1, 0, 720905, 1, 0, 720906, 1, 0, 720907, 1, 0, 720908, 1, 0, 720909, 2, 0, 720910, 1, 0, 720911, 1, 0, 720912, 1, 0, 720913, 1, 0, 720914, 1, 0, 720915, 3, 0, 851961, 2, 0, 851962, 2, 0, 851963, 2, 0, 851964, 2, 0, 851965, 2, 0, 851966, 2, 0, 851967, 2, 0, 786432, 2, 0, 786433, 2, 0, 786434, 2, 0, 786435, 2, 0, 786436, 2, 0, 786437, 1, 0, 786438, 2, 0, 786439, 2, 0, 786440, 2, 0, 786441, 2, 0, 786442, 2, 0, 786443, 2, 0, 786444, 2, 0, 786445, 2, 0, 786446, 2, 0, 786447, 2, 0, 786448, 2, 0, 786449, 2, 0, 786450, 2, 0, 786451, 2, 0 ) +tile_data = PoolIntArray( 262137, 2, 0, 262138, 2, 0, 262139, 2, 0, 262140, 2, 0, 262141, 2, 0, 262142, 2, 0, 262143, 2, 0, 196608, 2, 0, 196609, 2, 0, 196610, 2, 0, 196611, 2, 0, 196612, 2, 0, 196613, 2, 0, 196614, 2, 0, 196615, 2, 0, 196616, 2, 0, 196617, 2, 0, 196618, 2, 0, 196619, 2, 0, 196620, 2, 0, 196621, 2, 0, 196622, 2, 0, 196623, 2, 0, 196624, 2, 0, 196625, 2, 0, 196626, 2, 0, 196627, 2, 0, 327673, 2, 0, 327674, 1, 0, 327675, 1, 0, 327676, 1, 0, 327677, 1, 0, 327678, 1, 0, 327679, 2, 0, 262144, 1, 0, 262145, 1, 0, 262146, 1, 0, 262147, 1, 0, 262148, 1, 0, 262149, 1, 0, 262150, 1, 0, 262151, 1, 0, 262152, 1, 0, 262153, 1, 0, 262154, 1, 0, 262155, 1, 0, 262156, 1, 0, 262157, 2, 0, 262158, 1, 0, 262159, 1, 0, 262160, 1, 0, 262161, 1, 0, 262162, 1, 0, 262163, 3, 0, 393209, 2, 0, 393210, 1, 0, 393211, 1, 0, 393212, 1, 0, 393213, 1, 0, 393214, 1, 0, 393215, 2, 0, 327680, 1, 0, 327681, 1, 0, 327682, 1, 0, 327683, 1, 0, 327684, 1, 0, 327685, 1, 0, 327686, 1, 0, 327687, 1, 0, 327688, 1, 0, 327689, 1, 0, 327690, 1, 0, 327691, 1, 0, 327692, 1, 0, 327693, 2, 0, 327694, 1, 0, 327695, 1, 0, 327696, 1, 0, 327697, 1, 0, 327698, 1, 0, 327699, 3, 0, 458745, 2, 0, 458746, 1, 0, 458747, 1, 0, 458748, 1, 0, 458749, 1, 0, 458750, 1, 0, 458751, 1, 0, 393216, 1, 0, 393217, 1, 0, 393218, 1, 0, 393219, 1, 0, 393220, 1, 0, 393221, 1, 0, 393222, 1, 0, 393223, 1, 0, 393224, 1, 0, 393225, 1, 0, 393226, 1, 0, 393227, 1, 0, 393228, 1, 0, 393229, 1, 0, 393230, 1, 0, 393231, 1, 0, 393232, 1, 0, 393233, 1, 0, 393234, 1, 0, 393235, 3, 0, 524281, 2, 0, 524282, 1, 0, 524283, 1, 0, 524284, 1, 0, 524285, 1, 0, 524286, 1, 0, 524287, 3, 0, 458752, 1, 0, 458753, 1, 0, 458754, 1, 0, 458755, 1, 0, 458756, 1, 0, 458757, 1, 0, 458758, 1, 0, 458759, 1, 0, 458760, 1, 0, 458761, 1, 0, 458762, 1, 0, 458763, 1, 0, 458764, 1, 0, 458765, 3, 0, 458766, 1, 0, 458767, 1, 0, 458768, 1, 0, 458769, 1, 0, 458770, 1, 0, 458771, 3, 0, 589817, 2, 0, 589818, 1, 0, 589819, 1, 0, 589820, 1, 0, 589821, 1, 0, 589822, 1, 0, 589823, 3, 0, 524288, 1, 0, 524289, 1, 0, 524290, 1, 0, 524291, 1, 0, 524292, 1, 0, 524293, 1, 0, 524294, 1, 0, 524295, 1, 0, 524296, 1, 0, 524297, 1, 0, 524298, 1, 0, 524299, 1, 0, 524300, 1, 0, 524301, 3, 0, 524302, 1, 0, 524303, 1, 0, 524304, 1, 0, 524305, 1, 0, 524306, 1, 0, 524307, 3, 0, 655353, 2, 0, 655354, 1, 0, 655355, 1, 0, 655356, 1, 0, 655357, 1, 0, 655358, 1, 0, 655359, 1, 0, 589824, 1, 0, 589825, 1, 0, 589826, 1, 0, 589827, 1, 0, 589828, 1, 0, 589829, 1, 0, 589830, 1, 0, 589831, 1, 0, 589832, 1, 0, 589833, 1, 0, 589834, 1, 0, 589835, 1, 0, 589836, 1, 0, 589837, 1, 0, 589838, 1, 0, 589839, 1, 0, 589840, 1, 0, 589841, 1, 0, 589842, 1, 0, 589843, 3, 0, 720889, 2, 0, 720890, 1, 0, 720891, 1, 0, 720892, 1, 0, 720893, 1, 0, 720894, 1, 0, 720895, 2, 0, 655360, 1, 0, 655361, 1, 0, 655362, 1, 0, 655363, 1, 0, 655364, 1, 0, 655365, 1, 0, 655366, 1, 0, 655367, 1, 0, 655368, 1, 0, 655369, 1, 0, 655370, 1, 0, 655371, 1, 0, 655372, 1, 0, 655373, 2, 0, 655374, 1, 0, 655375, 1, 0, 655376, 1, 0, 655377, 1, 0, 655378, 1, 0, 655379, 3, 0, 786425, 2, 0, 786426, 1, 0, 786427, 1, 0, 786428, 1, 0, 786429, 1, 0, 786430, 1, 0, 786431, 2, 0, 720896, 1, 0, 720897, 1, 0, 720898, 1, 0, 720899, 1, 0, 720900, 1, 0, 720901, 1, 0, 720902, 1, 0, 720903, 1, 0, 720904, 1, 0, 720905, 1, 0, 720906, 1, 0, 720907, 1, 0, 720908, 1, 0, 720909, 2, 0, 720910, 1, 0, 720911, 1, 0, 720912, 1, 0, 720913, 1, 0, 720914, 1, 0, 720915, 3, 0, 851961, 2, 0, 851962, 2, 0, 851963, 2, 0, 851964, 2, 0, 851965, 2, 0, 851966, 2, 0, 851967, 2, 0, 786432, 2, 0, 786433, 2, 0, 786434, 2, 0, 786435, 2, 0, 786436, 2, 0, 786437, 1, 0, 786438, 2, 0, 786439, 2, 0, 786440, 2, 0, 786441, 2, 0, 786442, 2, 0, 786443, 2, 0, 786444, 2, 0, 786445, 2, 0, 786446, 2, 0, 786447, 2, 0, 786448, 2, 0, 786449, 2, 0, 786450, 2, 0, 786451, 2, 0 ) script = ExtResource( 3 ) extended_tilemap_node = NodePath("../1x1") diff --git a/Scenes/UI.gd b/Scenes/UI.gd new file mode 100644 index 0000000..6e99692 --- /dev/null +++ b/Scenes/UI.gd @@ -0,0 +1,5 @@ +extends Control + +class_name GameUI + +signal command(command) diff --git a/Scenes/World.gd b/Scenes/World.gd index 7eacbc7..a085f4c 100755 --- a/Scenes/World.gd +++ b/Scenes/World.gd @@ -1,5 +1,7 @@ extends Node2D +class_name GameWorld + export(NodePath) var player_path export(NodePath) var map_path diff --git a/Scenes/ui.tscn b/Scenes/ui.tscn new file mode 100644 index 0000000..f9ecb00 --- /dev/null +++ b/Scenes/ui.tscn @@ -0,0 +1,8 @@ +[gd_scene format=2] + +[node name="ui" type="Control"] +margin_right = 40.0 +margin_bottom = 40.0 +__meta__ = { +"_edit_use_anchors_": false +} diff --git a/project.godot b/project.godot index 98bb765..02d42cf 100644 --- a/project.godot +++ b/project.godot @@ -9,6 +9,21 @@ config_version=4 _global_script_classes=[ { +"base": "Node", +"class": "GameInstance", +"language": "GDScript", +"path": "res://Scenes/Game.gd" +}, { +"base": "Control", +"class": "GameUI", +"language": "GDScript", +"path": "res://Scenes/UI.gd" +}, { +"base": "Node2D", +"class": "GameWorld", +"language": "GDScript", +"path": "res://Scenes/World.gd" +}, { "base": "Node2D", "class": "Map", "language": "GDScript", @@ -23,17 +38,26 @@ _global_script_classes=[ { "class": "Occluder", "language": "GDScript", "path": "res://Scenes/Rendering/Occluder.gd" +}, { +"base": "Reference", +"class": "UICommand", +"language": "GDScript", +"path": "res://Classes/UICommand.gd" } ] _global_script_class_icons={ +"GameInstance": "", +"GameUI": "", +"GameWorld": "", "Map": "", "MapTiles": "", -"Occluder": "" +"Occluder": "", +"UICommand": "" } [application] config/name="odyssey" -run/main_scene="res://Scenes/Test.tscn" +run/main_scene="res://Scenes/Game.tscn" config/icon="res://icon.png" [display]