Doors work

This commit is contained in:
Logan 2020-07-23 23:00:24 -05:00
parent 4e28f95b28
commit f5cfe87aef
3 changed files with 42 additions and 27 deletions

File diff suppressed because one or more lines are too long

View file

@ -14,7 +14,7 @@ func _process(delta):
if unlocked: if unlocked:
$Label.text = "F to Open" $Label.text = "F to Open"
if Input.is_action_just_pressed("open"): if Input.is_action_just_pressed("open"):
$CanvasLayer.AnimationPlayer.play("fadeout") $CanvasLayer/AnimationPlayer.play("fadeout")
else: else:
$Label.text = "Locked" $Label.text = "Locked"
$Label.visible = true $Label.visible = true
@ -27,8 +27,6 @@ func lock():
func unlock(): func unlock():
unlocked = true unlocked = true
func _on_Timer_timeout():
func _on__animation_finished(anim_name):
Player.current_scene = next_scene Player.current_scene = next_scene
get_tree().change_scene(""+next_scene+"") get_tree().change_scene(""+next_scene+"")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=2] [gd_scene load_steps=10 format=2]
[ext_resource path="res://Music and Fonts(Misc.)/m5x7.tres" type="DynamicFontData" id=1] [ext_resource path="res://Music and Fonts(Misc.)/m5x7.tres" type="DynamicFontData" id=1]
[ext_resource path="res://art/door.png" type="Texture" id=2] [ext_resource path="res://art/door.png" type="Texture" id=2]
@ -22,7 +22,7 @@ tracks/0/imported = false
tracks/0/enabled = true tracks/0/enabled = true
tracks/0/keys = { tracks/0/keys = {
"times": PoolRealArray( 0, 1 ), "times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ), "transitions": PoolRealArray( 1, 2.87872e-08 ),
"update": 0, "update": 0,
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ] "values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
} }
@ -38,6 +38,28 @@ tracks/1/keys = {
"update": 0, "update": 0,
"values": [ 0.0, 1.0 ] "values": [ 0.0, 1.0 ]
} }
tracks/2/type = "method"
tracks/2/path = NodePath("Timer")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 2 ),
"transitions": PoolRealArray( 1 ),
"values": [ {
"args": [ -1 ],
"method": "start"
} ]
}
[sub_resource type="DynamicFontData" id=4]
antialiased = false
font_path = "res://Music and Fonts(Misc.)/m5x7.ttf"
[sub_resource type="DynamicFont" id=5]
size = 36
font_data = SubResource( 4 )
[node name="Door" type="Sprite"] [node name="Door" type="Sprite"]
position = Vector2( -16, -32 ) position = Vector2( -16, -32 )
@ -80,10 +102,17 @@ margin_left = 80.0
margin_top = 60.0 margin_top = 60.0
margin_right = 240.0 margin_right = 240.0
margin_bottom = 120.0 margin_bottom = 120.0
custom_fonts/font = SubResource( 5 )
align = 1 align = 1
valign = 1 valign = 1
autowrap = true
percent_visible = 0.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Timer" type="Timer" parent="CanvasLayer"]
one_shot = true
[connection signal="body_entered" from="Area2D" to="Area2D" method="_on_Area2D_body_entered"] [connection signal="body_entered" from="Area2D" to="Area2D" method="_on_Area2D_body_entered"]
[connection signal="animation_finished" from="CanvasLayer/AnimationPlayer" to="." method="_on__animation_finished"] [connection signal="animation_started" from="CanvasLayer/AnimationPlayer" to="." method="_on_animation_started"]
[connection signal="timeout" from="CanvasLayer/Timer" to="." method="_on_Timer_timeout"]