Added shader disabling flag to doors
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
class_name BookDoor
|
class_name BookDoor
|
||||||
extends LockedDoor
|
extends LockedDoor
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
class_name CircleDoor
|
class_name CircleDoor
|
||||||
extends LockedDoor
|
extends LockedDoor
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
class_name Door
|
class_name Door
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
@@ -8,6 +9,13 @@ const ANIMATION_OPENING = "opening"
|
|||||||
const ANIMATION_CLOSING = "closing"
|
const ANIMATION_CLOSING = "closing"
|
||||||
|
|
||||||
|
|
||||||
|
@export var use_shader := true:
|
||||||
|
set(value):
|
||||||
|
use_shader = value
|
||||||
|
if is_node_ready():
|
||||||
|
_update_shader()
|
||||||
|
|
||||||
|
|
||||||
var _needed_to_be_open := false
|
var _needed_to_be_open := false
|
||||||
var _needed_to_be_closed := false
|
var _needed_to_be_closed := false
|
||||||
|
|
||||||
@@ -19,6 +27,7 @@ var _needed_to_be_closed := false
|
|||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
|
_update_shader()
|
||||||
sprite.play(ANIMATION_CLOSED)
|
sprite.play(ANIMATION_CLOSED)
|
||||||
|
|
||||||
|
|
||||||
@@ -50,6 +59,12 @@ func _close() -> void:
|
|||||||
static_body.process_mode = Node.PROCESS_MODE_INHERIT
|
static_body.process_mode = Node.PROCESS_MODE_INHERIT
|
||||||
|
|
||||||
|
|
||||||
|
func _update_shader() -> void:
|
||||||
|
var intensity := 0.5 if use_shader else 1.0
|
||||||
|
print(intensity)
|
||||||
|
sprite.material.set(CollisionSwitcher.SHADER_INTENSITY, intensity)
|
||||||
|
|
||||||
|
|
||||||
func _on_animation_finished() -> void:
|
func _on_animation_finished() -> void:
|
||||||
match sprite.animation:
|
match sprite.animation:
|
||||||
ANIMATION_OPENING:
|
ANIMATION_OPENING:
|
||||||
|
|||||||
+12
-11
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=15 format=3 uid="uid://b7mhdrj3b6loq"]
|
[gd_scene format=3 uid="uid://b7mhdrj3b6loq"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://5uqub2a6701b" path="res://game/doors/door.gd" id="1_vx1od"]
|
[ext_resource type="Script" uid="uid://5uqub2a6701b" path="res://game/doors/door.gd" id="1_vx1od"]
|
||||||
[ext_resource type="Material" uid="uid://dojhoc6ljpt1a" path="res://game/materials/walls_gray.tres" id="1_xelsh"]
|
[ext_resource type="Material" uid="uid://dojhoc6ljpt1a" path="res://game/materials/walls_gray.tres" id="1_xelsh"]
|
||||||
@@ -48,7 +48,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_5nqrw")
|
"texture": SubResource("AtlasTexture_5nqrw")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": 1,
|
||||||
"name": &"closed",
|
"name": &"closed",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
@@ -62,7 +62,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_4vug2")
|
"texture": SubResource("AtlasTexture_4vug2")
|
||||||
}],
|
}],
|
||||||
"loop": false,
|
"loop": 0,
|
||||||
"name": &"closing",
|
"name": &"closing",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}, {
|
}, {
|
||||||
@@ -70,7 +70,7 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_ymlcn")
|
"texture": SubResource("AtlasTexture_ymlcn")
|
||||||
}],
|
}],
|
||||||
"loop": true,
|
"loop": 1,
|
||||||
"name": &"open",
|
"name": &"open",
|
||||||
"speed": 5.0
|
"speed": 5.0
|
||||||
}, {
|
}, {
|
||||||
@@ -84,34 +84,35 @@ animations = [{
|
|||||||
"duration": 1.0,
|
"duration": 1.0,
|
||||||
"texture": SubResource("AtlasTexture_j83fq")
|
"texture": SubResource("AtlasTexture_j83fq")
|
||||||
}],
|
}],
|
||||||
"loop": false,
|
"loop": 0,
|
||||||
"name": &"opening",
|
"name": &"opening",
|
||||||
"speed": 10.0
|
"speed": 10.0
|
||||||
}]
|
}]
|
||||||
|
|
||||||
[node name="Door" type="Node2D"]
|
[node name="Door" type="Node2D" unique_id=2006466960]
|
||||||
script = ExtResource("1_vx1od")
|
script = ExtResource("1_vx1od")
|
||||||
|
|
||||||
[node name="StaticBody2D" type="StaticBody2D" parent="."]
|
[node name="StaticBody2D" type="StaticBody2D" parent="." unique_id=584436734]
|
||||||
position = Vector2(-8.5, 0)
|
position = Vector2(-8.5, 0)
|
||||||
|
|
||||||
[node name="StaticBodyCollision" type="CollisionShape2D" parent="StaticBody2D"]
|
[node name="StaticBodyCollision" type="CollisionShape2D" parent="StaticBody2D" unique_id=193176175]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
shape = SubResource("RectangleShape2D_cs8ri")
|
shape = SubResource("RectangleShape2D_cs8ri")
|
||||||
|
|
||||||
[node name="Area2D" type="Area2D" parent="."]
|
[node name="Area2D" type="Area2D" parent="." unique_id=371280403]
|
||||||
position = Vector2(-8.5, 0)
|
position = Vector2(-8.5, 0)
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 136
|
collision_mask = 136
|
||||||
|
|
||||||
[node name="AreaCollision" type="CollisionShape2D" parent="Area2D"]
|
[node name="AreaCollision" type="CollisionShape2D" parent="Area2D" unique_id=853891699]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
shape = SubResource("RectangleShape2D_u7b5a")
|
shape = SubResource("RectangleShape2D_u7b5a")
|
||||||
|
|
||||||
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
|
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1718827818]
|
||||||
material = ExtResource("1_xelsh")
|
material = ExtResource("1_xelsh")
|
||||||
sprite_frames = SubResource("SpriteFrames_r8rhb")
|
sprite_frames = SubResource("SpriteFrames_r8rhb")
|
||||||
animation = &"closed"
|
animation = &"closed"
|
||||||
|
frame_progress = 0.61261725
|
||||||
|
|
||||||
[connection signal="body_entered" from="Area2D" to="." method="_on_area_entered"]
|
[connection signal="body_entered" from="Area2D" to="." method="_on_area_entered"]
|
||||||
[connection signal="body_exited" from="Area2D" to="." method="_on_area_exited"]
|
[connection signal="body_exited" from="Area2D" to="." method="_on_area_exited"]
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
extends Door
|
extends Door
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
class_name LockedDoor
|
class_name LockedDoor
|
||||||
extends Door
|
extends Door
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
class_name SquareDoor
|
class_name SquareDoor
|
||||||
extends LockedDoor
|
extends LockedDoor
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
@tool
|
||||||
class_name TriagleDoor
|
class_name TriagleDoor
|
||||||
extends LockedDoor
|
extends LockedDoor
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user