This commit is contained in:
parent
f6c53bf5ca
commit
1adf5b5ed7
8 changed files with 114 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
26
map_point.gd
Normal file
26
map_point.gd
Normal file
|
|
@ -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)
|
||||
1
map_point.gd.uid
Normal file
1
map_point.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bhct6bhjtnml0
|
||||
48
map_point.tscn
Normal file
48
map_point.tscn
Normal file
|
|
@ -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"]
|
||||
|
|
@ -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]
|
||||
|
||||
|
|
|
|||
1
prototype_map.gd
Normal file
1
prototype_map.gd
Normal file
|
|
@ -0,0 +1 @@
|
|||
extends Node2D
|
||||
1
prototype_map.gd.uid
Normal file
1
prototype_map.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cvcec0uf3erkv
|
||||
36
prototype_map.tscn
Normal file
36
prototype_map.tscn
Normal file
|
|
@ -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)
|
||||
Loading…
Add table
Reference in a new issue