ajout du détecteur et liaison entre les scènes
This commit is contained in:
22
entities/interactables/door/door.tscn
Normal file
22
entities/interactables/door/door.tscn
Normal file
@@ -0,0 +1,22 @@
|
||||
[gd_scene format=3 uid="uid://b8m537op75gib"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bmxuqj0c6h60d" path="res://entities/interactables/door/script/door.gd" id="1_8kdwv"]
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_8kdwv"]
|
||||
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_oarg0"]
|
||||
gradient = SubResource("Gradient_8kdwv")
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_y51rk"]
|
||||
size = Vector2(64, 64)
|
||||
|
||||
[node name="Door" type="Area2D" unique_id=2053096538]
|
||||
script = ExtResource("1_8kdwv")
|
||||
metadata/_custom_type_script = "uid://dyprcd68fjstf"
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="." unique_id=874210487]
|
||||
texture = SubResource("GradientTexture2D_oarg0")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1809395872]
|
||||
shape = SubResource("RectangleShape2D_y51rk")
|
||||
19
entities/interactables/door/script/door.gd
Normal file
19
entities/interactables/door/script/door.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
@tool
|
||||
extends Interactable
|
||||
class_name Door
|
||||
|
||||
@export var to_scene_id = ""
|
||||
|
||||
func _ready():
|
||||
modulate = Color.WHITE if available else Color.RED
|
||||
|
||||
func interact(_p : Player) -> bool:
|
||||
if available and to_scene_id:
|
||||
interacted.emit(_p)
|
||||
SceneManager.change_to_scene_id(to_scene_id)
|
||||
|
||||
return available
|
||||
|
||||
func set_available(v : bool):
|
||||
available = v
|
||||
modulate = Color.WHITE if available else Color.RED
|
||||
1
entities/interactables/door/script/door.gd.uid
Normal file
1
entities/interactables/door/script/door.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bmxuqj0c6h60d
|
||||
Reference in New Issue
Block a user