fight system and whatnot
This commit is contained in:
129
scenes/interactables/dark_house_door.tscn
Normal file
129
scenes/interactables/dark_house_door.tscn
Normal file
@@ -0,0 +1,129 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://cac5cla8jdogn"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dsapnb753puib" path="res://assets/textures/spritesheets/dark_house_assets.png" id="1_s5xo4"]
|
||||
[ext_resource type="PackedScene" uid="uid://n24dhbpflcec" path="res://scenes/interactable.tscn" id="2_ljyl3"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_enrye"]
|
||||
script/source = "extends StaticBody2D
|
||||
|
||||
@onready var animation_player: AnimationPlayer = $AnimationPlayer
|
||||
@onready var anti_softlock_marker: Marker2D = $AntiSoftlockMarker
|
||||
|
||||
var open: bool = false
|
||||
var open1: bool = true
|
||||
|
||||
func _on_interactable_interacted(_player: Player) -> void:
|
||||
if !open:
|
||||
animation_player.play(\"open\")
|
||||
open = true
|
||||
|
||||
func _on_interactable_body_exited(body: Node2D) -> void:
|
||||
if open1 && body is Player:
|
||||
animation_player.speed_scale = 4
|
||||
animation_player.play_backwards(\"open\")
|
||||
open1 = false
|
||||
await animation_player.animation_finished
|
||||
body.global_position = anti_softlock_marker.global_position
|
||||
"
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nmjqc"]
|
||||
atlas = ExtResource("1_s5xo4")
|
||||
region = Rect2(160, 64, 32, 64)
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ra1dx"]
|
||||
resource_name = "open"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:texture:region")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Rect2(160, 64, 32, 64), Rect2(144, 64, 32, 64)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("CollisionShape2D2:shape:size")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(48, 5), Vector2(16, 5)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_xbx8n"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:texture:region")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Rect2(160, 64, 32, 64)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("CollisionShape2D2:shape:size")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(48, 5)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_clxe4"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_xbx8n"),
|
||||
&"open": SubResource("Animation_ra1dx")
|
||||
}
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_xpwqa"]
|
||||
size = Vector2(48, 5)
|
||||
|
||||
[node name="DarkHouseDoor" type="StaticBody2D"]
|
||||
script = SubResource("GDScript_enrye")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
position = Vector2(32, -16)
|
||||
texture = SubResource("AtlasTexture_nmjqc")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -16)
|
||||
texture = SubResource("AtlasTexture_nmjqc")
|
||||
flip_h = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_clxe4")
|
||||
}
|
||||
|
||||
[node name="Interactable" parent="." instance=ExtResource("2_ljyl3")]
|
||||
position = Vector2(16, 20)
|
||||
auto_interact = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-8, 13.5)
|
||||
shape = SubResource("RectangleShape2D_xpwqa")
|
||||
|
||||
[node name="CollisionShape2D2" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(40, 14)
|
||||
shape = SubResource("RectangleShape2D_xpwqa")
|
||||
|
||||
[node name="AntiSoftlockMarker" type="Marker2D" parent="."]
|
||||
position = Vector2(16, -26)
|
||||
|
||||
[connection signal="body_exited" from="Interactable" to="." method="_on_interactable_body_exited"]
|
||||
[connection signal="interacted" from="Interactable" to="." method="_on_interactable_interacted"]
|
||||
Reference in New Issue
Block a user