From f5cfe87aefe189f6b0f02e40654ce9dc816d0965 Mon Sep 17 00:00:00 2001 From: Logan Date: Thu, 23 Jul 2020 23:00:24 -0500 Subject: [PATCH] Doors work --- levels/Campaign/Level 1/Level 1.tscn | 28 +++++++--------------- objects/Door.gd | 6 ++--- objects/Door.tscn | 35 +++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/levels/Campaign/Level 1/Level 1.tscn b/levels/Campaign/Level 1/Level 1.tscn index 6b3f779..a360bca 100644 --- a/levels/Campaign/Level 1/Level 1.tscn +++ b/levels/Campaign/Level 1/Level 1.tscn @@ -1,13 +1,11 @@ -[gd_scene load_steps=18 format=2] +[gd_scene load_steps=16 format=2] [ext_resource path="res://meta/DungeonTilemap.tres" type="TileSet" id=1] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=2] [ext_resource path="res://Music and Fonts(Misc.)/m5x7.tres" type="DynamicFontData" id=3] [ext_resource path="res://objects/torch.tscn" type="PackedScene" id=4] [ext_resource path="res://art/door.png" type="Texture" id=5] -[ext_resource path="res://art/Paralax Dungeon.png" type="Texture" id=6] [ext_resource path="res://art/Black.png" type="Texture" id=7] -[ext_resource path="res://Music and Fonts(Misc.)/m5x7.ttf" type="DynamicFontData" id=8] [ext_resource path="res://levels/Campaign/Level 1/Leap Of Faith.gd" type="Script" id=9] [ext_resource path="res://levels/Campaign/Level 1/Timer.gd" type="Script" id=10] [ext_resource path="res://levels/Campaign/Level 1/AnimationPlayer.gd" type="Script" id=11] @@ -36,8 +34,8 @@ tracks/0/keys = { } [sub_resource type="DynamicFont" id=4] -size = 12 -font_data = ExtResource( 8 ) +size = 36 +font_data = ExtResource( 3 ) [node name="Level 1" type="Node"] @@ -110,15 +108,6 @@ collision_mask = 0 format = 1 tile_data = PoolIntArray( 65534, 0, 8, 65535, 0, 10, 0, 0, 10, 1, 0, 10, 2, 0, 10, 3, 0, 10, 4, 0, 10, 5, 0, 10, 6, 0, 10, 7, 0, 10, 8, 0, 10, 9, 0, 10, 10, 0, 10, 11, 0, 10, 12, 0, 10, 13, 0, 10, 14, 0, 10, 15, 0, 10, 16, 0, 10, 17, 0, 10, 18, 0, 10, 19, 0, 10, 20, 0, 10, 21, 0, 10, 22, 0, 10, 23, 0, 10, 24, 0, 10, 25, 0, 10, 26, 0, 10, 27, 0, 10, 28, 0, 10, 29, 0, 10, 30, 0, 10, 31, 0, 10, 32, 0, 10, 33, 0, 10, 34, 0, 10, 35, 0, 10, 36, 0, 10, 37, 0, 10, 38, 0, 10, 39, 0, 10, 40, 0, 10, 41, 0, 10, 42, 0, 10, 43, 0, 10, 44, 0, 10, 45, 0, 10, 46, 0, 10, 47, 0, 10, 48, 0, 10, 49, 0, 10, 50, 0, 10, 51, 0, 11, 131070, 0, 65544, 131071, 0, 131081, 65536, 0, 131081, 65537, 0, 131081, 65538, 0, 131081, 65539, 0, 131081, 65540, 0, 131081, 65541, 0, 131081, 65542, 0, 131081, 65543, 0, 131081, 65544, 0, 131081, 65545, 0, 131081, 65546, 0, 131081, 65547, 0, 131081, 65548, 0, 131081, 65549, 0, 131081, 65550, 0, 131081, 65551, 0, 131081, 65552, 0, 131081, 65553, 0, 131081, 65554, 0, 131081, 65555, 0, 131081, 65556, 0, 131081, 65557, 0, 131081, 65558, 0, 131081, 65559, 0, 131081, 65560, 0, 131081, 65561, 0, 131081, 65562, 0, 131081, 65563, 0, 131081, 65564, 0, 131081, 65565, 0, 131081, 65566, 0, 131081, 65567, 0, 131081, 65568, 0, 131081, 65569, 0, 131081, 65570, 0, 131081, 65571, 0, 131081, 65572, 0, 131081, 65573, 0, 131081, 65574, 0, 131081, 65575, 0, 131081, 65576, 0, 131081, 65577, 0, 131081, 65578, 0, 131081, 65579, 0, 131081, 65580, 0, 131081, 65581, 0, 131081, 65582, 0, 131081, 65583, 0, 131081, 65584, 0, 131081, 65585, 0, 131081, 65586, 0, 131081, 65587, 0, 131083, 196606, 0, 65544, 196607, 0, 131081, 131072, 0, 131078, 131073, 0, 196617, 131074, 0, 196617, 131075, 0, 196617, 131076, 0, 196617, 131077, 0, 196617, 131078, 0, 196617, 131079, 0, 196617, 131080, 0, 196617, 131081, 0, 196617, 131082, 0, 196617, 131083, 0, 196617, 131084, 0, 196617, 131085, 0, 196617, 131086, 0, 196617, 131087, 0, 196617, 131088, 0, 196617, 131089, 0, 196617, 131090, 0, 196617, 131091, 0, 196617, 131092, 0, 196617, 131093, 0, 196617, 131094, 0, 196617, 131095, 0, 196617, 131096, 0, 196617, 131097, 0, 196617, 131098, 0, 196617, 131099, 0, 196617, 131100, 0, 196617, 131101, 0, 196617, 131102, 0, 196617, 131103, 0, 196617, 131104, 0, 196617, 131105, 0, 196617, 131106, 0, 196617, 131107, 0, 196617, 131108, 0, 196617, 131109, 0, 196617, 131110, 0, 196617, 131111, 0, 196617, 131112, 0, 196617, 131113, 0, 196617, 131114, 0, 196617, 131115, 0, 196617, 131116, 0, 196617, 131117, 0, 131077, 131118, 0, 131081, 131119, 0, 131081, 131120, 0, 131081, 131121, 0, 131081, 131122, 0, 131081, 131123, 0, 131083, 262142, 0, 65544, 262143, 0, 131081, 196608, 0, 131083, 196653, 0, 65544, 196654, 0, 131081, 196655, 0, 131081, 196656, 0, 131081, 196657, 0, 131081, 196658, 0, 131081, 196659, 0, 131083, 327678, 0, 65544, 327679, 0, 131081, 262144, 0, 131083, 262189, 0, 65544, 262190, 0, 131081, 262191, 0, 131081, 262192, 0, 131081, 262193, 0, 131081, 262194, 0, 131081, 262195, 0, 131083, 393214, 0, 65544, 393215, 0, 131081, 327680, 0, 131083, 327725, 0, 65544, 327726, 0, 131081, 327727, 0, 131081, 327728, 0, 131081, 327729, 0, 131081, 327730, 0, 131081, 327731, 0, 131083, 458750, 0, 65544, 458751, 0, 131081, 393216, 0, 131083, 393261, 0, 65544, 393262, 0, 131081, 393263, 0, 131081, 393264, 0, 131081, 393265, 0, 131081, 393266, 0, 131081, 393267, 0, 131083, 524286, 0, 65544, 524287, 0, 131081, 458752, 0, 131083, 458797, 0, 65544, 458798, 0, 131081, 458799, 0, 131081, 458800, 0, 131081, 458801, 0, 131081, 458802, 0, 131081, 458803, 0, 131083, 589822, 0, 65544, 589823, 0, 131081, 524288, 0, 131083, 524333, 0, 65544, 524334, 0, 131081, 524335, 0, 131081, 524336, 0, 131081, 524337, 0, 131081, 524338, 0, 131081, 524339, 0, 131083, 655358, 0, 65544, 655359, 0, 131081, 589824, 0, 131083, 589869, 0, 65544, 589870, 0, 131081, 589871, 0, 131081, 589872, 0, 131081, 589873, 0, 131081, 589874, 0, 131081, 589875, 0, 131083, 720894, 0, 65544, 720895, 0, 131081, 655360, 0, 131083, 655405, 0, 65544, 655406, 0, 131081, 655407, 0, 131081, 655408, 0, 131081, 655409, 0, 131081, 655410, 0, 131081, 655411, 0, 131083, 786430, 0, 65544, 786431, 0, 131081, 720896, 0, 65542, 720897, 0, 10, 720898, 0, 10, 720899, 0, 10, 720900, 0, 10, 720901, 0, 10, 720902, 0, 10, 720903, 0, 10, 720904, 0, 10, 720905, 0, 10, 720906, 0, 10, 720907, 0, 10, 720908, 0, 10, 720909, 0, 10, 720910, 0, 10, 720911, 0, 10, 720912, 0, 10, 720913, 0, 10, 720914, 0, 10, 720915, 0, 10, 720916, 0, 10, 720917, 0, 10, 720918, 0, 10, 720919, 0, 10, 720920, 0, 10, 720921, 0, 10, 720922, 0, 10, 720923, 0, 10, 720924, 0, 10, 720925, 0, 10, 720926, 0, 10, 720927, 0, 10, 720928, 0, 10, 720929, 0, 10, 720930, 0, 10, 720931, 0, 10, 720932, 0, 10, 720933, 0, 11, 720941, 0, 65544, 720942, 0, 131081, 720943, 0, 131081, 720944, 0, 131081, 720945, 0, 131081, 720946, 0, 131081, 720947, 0, 131083, 851966, 0, 65544, 851967, 0, 131081, 786432, 0, 131081, 786433, 0, 131081, 786434, 0, 131081, 786435, 0, 131081, 786436, 0, 131081, 786437, 0, 131081, 786438, 0, 131081, 786439, 0, 131081, 786440, 0, 131081, 786441, 0, 131081, 786442, 0, 131081, 786443, 0, 131081, 786444, 0, 131081, 786445, 0, 131081, 786446, 0, 131081, 786447, 0, 131081, 786448, 0, 131081, 786449, 0, 131081, 786450, 0, 131081, 786451, 0, 131081, 786452, 0, 131081, 786453, 0, 131081, 786454, 0, 131081, 786455, 0, 131081, 786456, 0, 131081, 786457, 0, 131081, 786458, 0, 131081, 786459, 0, 131081, 786460, 0, 131081, 786461, 0, 131081, 786462, 0, 131081, 786463, 0, 131081, 786464, 0, 131081, 786465, 0, 131081, 786466, 0, 131081, 786467, 0, 131081, 786468, 0, 131081, 786469, 0, 131083, 786477, 0, 65544, 786478, 0, 131081, 786479, 0, 131081, 786480, 0, 131081, 786481, 0, 131081, 786482, 0, 131081, 786483, 0, 131083, 917502, 0, 196616, 917503, 0, 196617, 851968, 0, 196617, 851969, 0, 196617, 851970, 0, 196617, 851971, 0, 196617, 851972, 0, 196617, 851973, 0, 196617, 851974, 0, 196617, 851975, 0, 196617, 851976, 0, 196617, 851977, 0, 196617, 851978, 0, 196617, 851979, 0, 196617, 851980, 0, 196617, 851981, 0, 196617, 851982, 0, 196617, 851983, 0, 196617, 851984, 0, 196617, 851985, 0, 196617, 851986, 0, 196617, 851987, 0, 196617, 851988, 0, 196617, 851989, 0, 196617, 851990, 0, 196617, 851991, 0, 196617, 851992, 0, 196617, 851993, 0, 196617, 851994, 0, 196617, 851995, 0, 196617, 851996, 0, 196617, 851997, 0, 196617, 851998, 0, 196617, 851999, 0, 196617, 852000, 0, 196617, 852001, 0, 196617, 852002, 0, 196617, 852003, 0, 196617, 852004, 0, 196617, 852005, 0, 196619, 852013, 0, 196616, 852014, 0, 196617, 852015, 0, 196617, 852016, 0, 196617, 852017, 0, 196617, 852018, 0, 196617, 852019, 0, 196619 ) -[node name="ParallaxBackground" type="ParallaxBackground" parent="."] - -[node name="ParallaxLayer" type="ParallaxLayer" parent="ParallaxBackground"] -motion_mirroring = Vector2( 384, 180 ) - -[node name="Sprite" type="Sprite" parent="ParallaxBackground/ParallaxLayer"] -texture = ExtResource( 6 ) -centered = false - [node name="Player" parent="." instance=ExtResource( 2 )] position = Vector2( 30, 176 ) @@ -149,16 +138,15 @@ color = Color( 0.564706, 0.564706, 0.564706, 1 ) [node name="CanvasLayer" type="CanvasLayer" parent="."] [node name="Sprite" type="Sprite" parent="CanvasLayer"] -modulate = Color( 0, 0, 0, 1 ) +modulate = Color( 0, 0, 0, 0 ) texture = ExtResource( 7 ) centered = false [node name="Label" type="Label" parent="CanvasLayer"] -margin_left = -20.0 -margin_top = 60.0 -margin_right = 90.0 -margin_bottom = 76.0 -rect_scale = Vector2( 3.25, 3.25 ) +margin_left = 48.0 +margin_top = 64.0 +margin_right = 272.0 +margin_bottom = 125.0 custom_fonts/font = SubResource( 4 ) text = "Stage 1: Leap of Faith" diff --git a/objects/Door.gd b/objects/Door.gd index fc0a3f2..cf22e59 100644 --- a/objects/Door.gd +++ b/objects/Door.gd @@ -14,7 +14,7 @@ func _process(delta): if unlocked: $Label.text = "F to Open" if Input.is_action_just_pressed("open"): - $CanvasLayer.AnimationPlayer.play("fadeout") + $CanvasLayer/AnimationPlayer.play("fadeout") else: $Label.text = "Locked" $Label.visible = true @@ -27,8 +27,6 @@ func lock(): func unlock(): unlocked = true - - -func _on__animation_finished(anim_name): +func _on_Timer_timeout(): Player.current_scene = next_scene get_tree().change_scene(""+next_scene+"") diff --git a/objects/Door.tscn b/objects/Door.tscn index b23c7c5..038bcbe 100644 --- a/objects/Door.tscn +++ b/objects/Door.tscn @@ -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://art/door.png" type="Texture" id=2] @@ -22,7 +22,7 @@ tracks/0/imported = false tracks/0/enabled = true tracks/0/keys = { "times": PoolRealArray( 0, 1 ), -"transitions": PoolRealArray( 1, 1 ), +"transitions": PoolRealArray( 1, 2.87872e-08 ), "update": 0, "values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ] } @@ -38,6 +38,28 @@ tracks/1/keys = { "update": 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"] position = Vector2( -16, -32 ) @@ -80,10 +102,17 @@ margin_left = 80.0 margin_top = 60.0 margin_right = 240.0 margin_bottom = 120.0 +custom_fonts/font = SubResource( 5 ) align = 1 valign = 1 +autowrap = true +percent_visible = 0.0 __meta__ = { "_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="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"]