diff --git a/incantation_text.gd b/incantation_text.gd index 56b24b1..bf9ac1d 100644 --- a/incantation_text.gd +++ b/incantation_text.gd @@ -23,7 +23,5 @@ func _draw(): for c in text: var t = curve.sample_baked_with_rotation(offset) draw_set_transform(t.origin - (Vector2.UP * 5).rotated(t.get_rotation()), t.get_rotation()) - #t.rotated_local() - draw_char(get_theme_default_font(), Vector2.ZERO, c, 16, Color.WHITE if offset >= colored_offset else Color.RED) offset += 10 diff --git a/map_point.gd b/map_point.gd new file mode 100644 index 0000000..0acbc8f --- /dev/null +++ b/map_point.gd @@ -0,0 +1,26 @@ +@tool +class_name MapPoint +extends Node2D + + +@export_tool_button("Update lines", "Callable") var update_lines = queue_redraw +@export var connected_map_points: Array[MapPoint] = []: + set(new_value): + connected_map_points = new_value + queue_redraw() + +@onready var hover_dot: Sprite2D = $HoverDot + + +func _ready(): + queue_redraw() + +func _on_area_2d_mouse_entered(): + hover_dot.show() + +func _on_area_2d_mouse_exited(): + hover_dot.hide() + +func _draw(): + for p in connected_map_points: + draw_dashed_line(Vector2.ZERO, to_local(p.global_position), Color.BLACK) diff --git a/map_point.gd.uid b/map_point.gd.uid new file mode 100644 index 0000000..9fcbd30 --- /dev/null +++ b/map_point.gd.uid @@ -0,0 +1 @@ +uid://bhct6bhjtnml0 diff --git a/map_point.tscn b/map_point.tscn new file mode 100644 index 0000000..33183d9 --- /dev/null +++ b/map_point.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=7 format=3 uid="uid://b5tdh43sbe5nj"] + +[ext_resource type="Script" uid="uid://bhct6bhjtnml0" path="res://map_point.gd" id="1_jfx02"] + +[sub_resource type="Gradient" id="Gradient_tn1m0"] +offsets = PackedFloat32Array(0.40636, 0.45583) +colors = PackedColorArray(1, 1, 1, 1, 0, 0, 0, 0) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_pw3im"] +gradient = SubResource("Gradient_tn1m0") +width = 40 +height = 40 +fill = 1 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="Gradient" id="Gradient_ywy6p"] +offsets = PackedFloat32Array(0.40636, 0.45583) +colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 0) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_gpntq"] +gradient = SubResource("Gradient_ywy6p") +width = 32 +height = 32 +fill = 1 +fill_from = Vector2(0.5, 0.5) + +[sub_resource type="CircleShape2D" id="CircleShape2D_01fxh"] +radius = 13.0384 + +[node name="MapPoint" type="Node2D"] +script = ExtResource("1_jfx02") + +[node name="HoverDot" type="Sprite2D" parent="."] +visible = false +texture = SubResource("GradientTexture2D_pw3im") + +[node name="Dot" type="Sprite2D" parent="."] +texture = SubResource("GradientTexture2D_gpntq") + +[node name="Area2D" type="Area2D" parent="."] +collision_layer = 1024 +collision_mask = 1024 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] +shape = SubResource("CircleShape2D_01fxh") + +[connection signal="mouse_entered" from="Area2D" to="." method="_on_area_2d_mouse_entered"] +[connection signal="mouse_exited" from="Area2D" to="." method="_on_area_2d_mouse_exited"] diff --git a/project.godot b/project.godot index b5eef93..c4f2e71 100644 --- a/project.godot +++ b/project.godot @@ -39,6 +39,7 @@ theme/default_font_multichannel_signed_distance_field=true 2d_physics/layer_4="Pliers" 2d_physics/layer_9="Selectable" 2d_physics/layer_10="Incantation" +2d_physics/layer_11="Map" [rendering] diff --git a/prototype_map.gd b/prototype_map.gd new file mode 100644 index 0000000..e251cf8 --- /dev/null +++ b/prototype_map.gd @@ -0,0 +1 @@ +extends Node2D diff --git a/prototype_map.gd.uid b/prototype_map.gd.uid new file mode 100644 index 0000000..b3aaf2a --- /dev/null +++ b/prototype_map.gd.uid @@ -0,0 +1 @@ +uid://cvcec0uf3erkv diff --git a/prototype_map.tscn b/prototype_map.tscn new file mode 100644 index 0000000..3ff0e55 --- /dev/null +++ b/prototype_map.tscn @@ -0,0 +1,36 @@ +[gd_scene load_steps=5 format=3 uid="uid://cb4cokd0lxacj"] + +[ext_resource type="Script" uid="uid://cvcec0uf3erkv" path="res://prototype_map.gd" id="1_mj08v"] +[ext_resource type="PackedScene" uid="uid://b5tdh43sbe5nj" path="res://map_point.tscn" id="2_mj08v"] + +[sub_resource type="Gradient" id="Gradient_6vn6g"] +offsets = PackedFloat32Array(0.575972, 0.929329, 1) +colors = PackedColorArray(0.74902, 0.647059, 0.541176, 1, 0.61, 0.527447, 0.4392, 1, 0.19, 0.164287, 0.1368, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_fjiih"] +gradient = SubResource("Gradient_6vn6g") +width = 850 +height = 500 +fill = 2 +fill_from = Vector2(0.5, 0.5) + +[node name="PrototypeMap" type="Node2D"] +script = ExtResource("1_mj08v") + +[node name="Background" type="Sprite2D" parent="."] +position = Vector2(497, 315) +texture = SubResource("GradientTexture2D_fjiih") + +[node name="MapPoint" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")] +position = Vector2(199, 332) +connected_map_points = [NodePath("../MapPoint2")] + +[node name="MapPoint2" parent="." node_paths=PackedStringArray("connected_map_points") instance=ExtResource("2_mj08v")] +position = Vector2(256, 299) +connected_map_points = [NodePath("../MapPoint3"), NodePath("../MapPoint4")] + +[node name="MapPoint3" parent="." instance=ExtResource("2_mj08v")] +position = Vector2(315, 278) + +[node name="MapPoint4" parent="." instance=ExtResource("2_mj08v")] +position = Vector2(320, 330)