generated from SGDA/GodotExampleProject
feat: small world and interactibles
This commit is contained in:
17
scenes/interactibles/interactible.gd
Normal file
17
scenes/interactibles/interactible.gd
Normal file
@ -0,0 +1,17 @@
|
||||
extends Area2D
|
||||
class_name Interactible
|
||||
|
||||
@export_file("*.tscn") var scene_to_trigger : String
|
||||
|
||||
@onready var rich_text_label: RichTextLabel = $RichTextLabel
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
rich_text_label.visible = false
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
rich_text_label.visible = true
|
||||
|
||||
func _on_body_exited(body: Node2D) -> void:
|
||||
rich_text_label.visible = false
|
1
scenes/interactibles/interactible.gd.uid
Normal file
1
scenes/interactibles/interactible.gd.uid
Normal file
@ -0,0 +1 @@
|
||||
uid://dl18owt8pb11r
|
27
scenes/interactibles/interactible.tscn
Normal file
27
scenes/interactibles/interactible.tscn
Normal file
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cjo7jm55bkqk3"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dl18owt8pb11r" path="res://scenes/interactibles/interactible.gd" id="1_7dp4u"]
|
||||
[ext_resource type="FontFile" uid="uid://detctsm8oy251" path="res://assets/PansyHand/pansyhand.ttf" id="2_u3pc4"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_oyfc1"]
|
||||
radius = 20.0
|
||||
|
||||
[node name="Interactible" type="Area2D"]
|
||||
collision_layer = 4
|
||||
collision_mask = 2
|
||||
script = ExtResource("1_7dp4u")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_oyfc1")
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="."]
|
||||
z_index = 1000
|
||||
offset_left = 6.0
|
||||
offset_top = -17.0
|
||||
offset_right = 128.0
|
||||
offset_bottom = 23.0
|
||||
theme_override_fonts/normal_font = ExtResource("2_u3pc4")
|
||||
text = "INTERACT"
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="body_exited" from="." to="." method="_on_body_exited"]
|
Reference in New Issue
Block a user