feat: add new npc node; add interactable group to the project; add intreactable area to the player;

This commit is contained in:
2026-09-19 16:46:29 +02:00
parent 5b7c474f32
commit 5c3a533559
7 changed files with 122 additions and 11 deletions
+11
View File
@@ -0,0 +1,11 @@
extends StaticBody2D
var can_interact: bool = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
if Input.is_action_just_pressed("Interact") and can_interact:
if $CanvasLayer.visible == false:
$CanvasLayer.visible = true
else:
$CanvasLayer.visible = false
+1
View File
@@ -0,0 +1 @@
uid://b54jmbhu1hrbt
+55
View File
@@ -0,0 +1,55 @@
[gd_scene format=3 uid="uid://dsb83tlcapw8l"]
[ext_resource type="Texture2D" uid="uid://by4iu18wmj6ui" path="res://Ninja Adventure - Asset Pack/Actor/Characters/NinjaBlue/SpriteSheet.png" id="1_3am0f"]
[ext_resource type="Script" uid="uid://b54jmbhu1hrbt" path="res://Scenes/NPC/npc.gd" id="1_bjna2"]
[ext_resource type="Texture2D" uid="uid://ctpnixa3dpms5" path="res://Ninja Adventure - Asset Pack/Ui/Dialog/DialogBoxFaceset.png" id="3_0s07e"]
[ext_resource type="Texture2D" uid="uid://cn881vxquv6ub" path="res://Ninja Adventure - Asset Pack/Actor/Characters/NinjaBlue/Faceset.png" id="4_aqj1y"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_chgu2"]
size = Vector2(14, 13)
[sub_resource type="AtlasTexture" id="AtlasTexture_chgu2"]
atlas = ExtResource("1_3am0f")
region = Rect2(0, 0, 16, 16)
[sub_resource type="LabelSettings" id="LabelSettings_0s07e"]
font_size = 48
font_color = Color(0, 0, 0, 1)
[node name="NPC" type="StaticBody2D" unique_id=687608910]
script = ExtResource("1_bjna2")
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1581401512]
position = Vector2(0, 0.5)
shape = SubResource("RectangleShape2D_chgu2")
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=2127209036]
texture = SubResource("AtlasTexture_chgu2")
[node name="CanvasLayer" type="CanvasLayer" parent="." unique_id=1510478417]
visible = false
[node name="TextureRect" type="TextureRect" parent="CanvasLayer" unique_id=2039853714]
offset_left = 428.0
offset_top = 498.0
offset_right = 728.0
offset_bottom = 556.0
offset_transform_enabled = true
offset_transform_scale = Vector2(3.7, 3.7)
texture = ExtResource("3_0s07e")
[node name="TextureRect" type="TextureRect" parent="CanvasLayer/TextureRect" unique_id=1385209557]
layout_mode = 0
offset_left = 5.0
offset_top = 14.0
offset_right = 45.0
offset_bottom = 54.0
texture = ExtResource("4_aqj1y")
[node name="Label" type="Label" parent="CanvasLayer" unique_id=439922902]
offset_left = 208.0
offset_top = 472.0
offset_right = 492.0
offset_bottom = 539.0
text = "Hello World!"
label_settings = SubResource("LabelSettings_0s07e")