diff --git a/Enemies/Snowball Blue.tscn b/Enemies/Snowball Blue.tscn index 0c8e7b4..01ad934 100644 --- a/Enemies/Snowball Blue.tscn +++ b/Enemies/Snowball Blue.tscn @@ -7,7 +7,7 @@ radius = 4.47823 [node name="snowball_blue" type="Area2D" groups=[ -"enemy_projectile_1", +"freeze", ]] collision_layer = 0 collision_mask = 2 diff --git a/Enemies/Snowman Enemy Blue.tscn b/Enemies/Snowman Enemy Blue.tscn index 120a23e..1f61a44 100644 --- a/Enemies/Snowman Enemy Blue.tscn +++ b/Enemies/Snowman Enemy Blue.tscn @@ -14,7 +14,9 @@ radius = 58.0175 radius = 6.0 height = 5.0 -[node name="snowmen_enemy" type="KinematicBody2D"] +[node name="snowmen_enemy" type="KinematicBody2D" groups=[ +"freeze", +]] collision_layer = 2 script = ExtResource( 2 ) @@ -38,7 +40,7 @@ shape = SubResource( 2 ) autostart = true [node name="hitbox" type="Area2D" parent="." groups=[ -"enemy_hitbox_1", +"freeze", ]] collision_layer = 4 collision_mask = 2 @@ -49,3 +51,4 @@ shape = SubResource( 3 ) [connection signal="body_entered" from="detection" to="." method="_on_Area2D_body_entered"] [connection signal="body_exited" from="detection" to="." method="_on_Area2D_body_exited"] [connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] +[connection signal="area_entered" from="hitbox" to="." method="_on_hitbox_area_entered"] diff --git a/Enemies/Snowman Enemy.tscn b/Enemies/Snowman Enemy.tscn index 12414b7..7d0c340 100644 --- a/Enemies/Snowman Enemy.tscn +++ b/Enemies/Snowman Enemy.tscn @@ -14,7 +14,9 @@ radius = 56.0659 radius = 6.0 height = 5.0 -[node name="snowmen_enemy" type="KinematicBody2D"] +[node name="snowmen_enemy" type="KinematicBody2D" groups=[ +"enemy", +]] collision_layer = 2 script = ExtResource( 2 ) @@ -50,3 +52,4 @@ shape = SubResource( 3 ) [connection signal="body_entered" from="detection" to="." method="_on_Area2D_body_entered"] [connection signal="body_exited" from="detection" to="." method="_on_Area2D_body_exited"] [connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"] +[connection signal="area_entered" from="hitbox" to="." method="_on_hitbox_area_entered"] diff --git a/Levels/Level 3.tscn b/Levels/Level 3.tscn index e8f834f..7c2ef13 100644 --- a/Levels/Level 3.tscn +++ b/Levels/Level 3.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=2] +[gd_scene load_steps=22 format=2] [ext_resource path="res://Player/Player.tscn" type="PackedScene" id=1] [ext_resource path="res://Levels/Level 3.gd" type="Script" id=2] @@ -15,22 +15,23 @@ [ext_resource path="res://Levels/Objects/TreasureChest_L3.gd" type="Script" id=13] [ext_resource path="res://Levels/Objects/IceDoor.tscn" type="PackedScene" id=14] [ext_resource path="res://Levels/Objects/IceDoor.gd" type="Script" id=15] +[ext_resource path="res://Levels/SlowTime.gd" type="Script" id=16] -[sub_resource type="RectangleShape2D" id=4] +[sub_resource type="RectangleShape2D" id=1] extents = Vector2( 14.2575, 4.53175 ) -[sub_resource type="RectangleShape2D" id=5] +[sub_resource type="RectangleShape2D" id=2] extents = Vector2( 13.5227, 15.1025 ) -[sub_resource type="SegmentShape2D" id=1] +[sub_resource type="SegmentShape2D" id=3] a = Vector2( 3.84175, -99.0063 ) b = Vector2( 4.68997, 139.153 ) -[sub_resource type="SegmentShape2D" id=2] +[sub_resource type="SegmentShape2D" id=4] a = Vector2( -12.0323, 29.5732 ) b = Vector2( 339.344, 29.8339 ) -[sub_resource type="SegmentShape2D" id=3] +[sub_resource type="SegmentShape2D" id=5] a = Vector2( 400.865, 207.97 ) b = Vector2( 51.2007, 207.999 ) @@ -43,7 +44,7 @@ cell_size = Vector2( 16, 16 ) cell_custom_transform = Transform2D( 16, 0, 0, 16, 0, 0 ) occluder_light_mask = 0 format = 1 -tile_data = PoolIntArray( 0, 0, 65537, 1, 0, 65538, 2, 0, 65538, 3, 0, 65538, 4, 0, 65538, 5, 0, 65538, 6, 0, 65538, 7, 0, 65538, 8, 0, 65538, 9, 0, 65538, 10, 0, 65538, 11, 0, 65538, 12, 0, 65538, 13, 0, 65538, 14, 0, 65538, 15, 0, 65538, 16, 0, 65538, 17, 0, 65538, 18, 0, 65538, 19, 0, 65538, 20, 0, 65538, 21, 0, 65539, 65536, 0, 131073, 65537, 0, 131074, 65538, 0, 131074, 65539, 0, 131074, 65540, 0, 131074, 65541, 0, 131074, 65542, 0, 131074, 65543, 0, 131074, 65544, 0, 131074, 65545, 0, 131074, 65546, 0, 131074, 65547, 0, 131074, 65548, 0, 131074, 65549, 0, 131074, 65550, 0, 131074, 65551, 0, 131074, 65552, 0, 131074, 65553, 0, 131074, 65554, 0, 131074, 65555, 0, 131074, 65556, 0, 131074, 65557, 0, 131075, 131072, 0, 131073, 131073, 0, 131074, 131074, 0, 131074, 131075, 0, 131074, 131076, 0, 131074, 131077, 0, 131074, 131078, 0, 131074, 131079, 0, 131074, 131080, 0, 131074, 131081, 0, 131074, 131082, 0, 131074, 131083, 0, 131074, 131084, 0, 131074, 131085, 0, 131074, 131086, 0, 131074, 131087, 0, 131074, 131088, 0, 131074, 131089, 0, 131074, 131090, 0, 131074, 131091, 0, 131074, 131092, 0, 131074, 131093, 0, 131075, 196608, 0, 131073, 196609, 0, 131074, 196610, 0, 131074, 196611, 0, 131074, 196612, 0, 131074, 196613, 0, 131074, 196614, 0, 131074, 196615, 0, 131074, 196616, 0, 131074, 196617, 0, 131074, 196618, 0, 131074, 196619, 0, 131074, 196620, 0, 131074, 196621, 0, 131074, 196622, 0, 131074, 196623, 0, 131074, 196624, 0, 131074, 196625, 0, 131074, 196626, 0, 131074, 196627, 0, 131074, 196628, 0, 131074, 196629, 0, 131075, 262144, 0, 131073, 262145, 0, 131074, 262146, 0, 131074, 262147, 0, 131074, 262148, 0, 131074, 262149, 0, 131074, 262150, 0, 131074, 262151, 0, 131074, 262152, 0, 131074, 262153, 0, 131074, 262154, 0, 131074, 262155, 0, 131074, 262156, 0, 131074, 262157, 0, 131074, 262158, 0, 131074, 262159, 0, 131074, 262160, 0, 131074, 262161, 0, 131074, 262162, 0, 131074, 262163, 0, 131074, 262164, 0, 131074, 262165, 0, 131075, 327680, 0, 131073, 327681, 0, 131074, 327682, 0, 131074, 327683, 0, 131074, 327684, 0, 131074, 327685, 0, 131074, 327686, 0, 131074, 327687, 0, 131074, 327688, 0, 131074, 327689, 0, 131074, 327690, 0, 131074, 327691, 0, 131074, 327692, 0, 131074, 327693, 0, 131074, 327694, 0, 131074, 327695, 0, 131074, 327696, 0, 131074, 327697, 0, 131074, 327698, 0, 131074, 327699, 0, 131074, 327700, 0, 131074, 327701, 0, 131075, 393216, 0, 131073, 393217, 0, 131074, 393218, 0, 131074, 393219, 0, 131074, 393220, 0, 131074, 393221, 0, 131074, 393222, 0, 131074, 393223, 0, 131074, 393224, 0, 131074, 393225, 0, 131074, 393226, 0, 131074, 393227, 0, 131074, 393228, 0, 131074, 393229, 0, 131074, 393230, 0, 131074, 393231, 0, 131074, 393232, 0, 131074, 393233, 0, 131074, 393234, 0, 131074, 393235, 0, 131074, 393236, 0, 131074, 393237, 0, 131075, 458752, 0, 131073, 458753, 0, 131074, 458754, 0, 131074, 458755, 0, 131074, 458756, 0, 131074, 458757, 0, 131074, 458758, 0, 131074, 458759, 0, 131074, 458760, 0, 131074, 458761, 0, 131074, 458762, 0, 131074, 458763, 0, 131074, 458764, 0, 131074, 458765, 0, 131074, 458766, 0, 131074, 458767, 0, 131074, 458768, 0, 131074, 458769, 0, 131074, 458770, 0, 131074, 458771, 0, 131074, 458772, 0, 131074, 458773, 0, 131075, 524288, 0, 131073, 524289, 0, 131074, 524290, 0, 131074, 524291, 0, 131074, 524292, 0, 131074, 524293, 0, 131074, 524294, 0, 131074, 524295, 0, 131074, 524296, 0, 131074, 524297, 0, 131074, 524298, 0, 131074, 524299, 0, 131074, 524300, 0, 131074, 524301, 0, 131074, 524302, 0, 131074, 524303, 0, 131074, 524304, 0, 131074, 524305, 0, 131074, 524306, 0, 131074, 524307, 0, 131074, 524308, 0, 131074, 524309, 0, 131075, 589824, 0, 131073, 589825, 0, 131074, 589826, 0, 131074, 589827, 0, 131074, 589828, 0, 131074, 589829, 0, 131074, 589830, 0, 131074, 589831, 0, 131074, 589832, 0, 131074, 589833, 0, 131074, 589834, 0, 131074, 589835, 0, 131074, 589836, 0, 131074, 589837, 0, 131074, 589838, 0, 131074, 589839, 0, 131074, 589840, 0, 131074, 589841, 0, 131074, 589842, 0, 131074, 589843, 0, 131074, 589844, 0, 131074, 589845, 0, 131075, 655360, 0, 131073, 655361, 0, 131074, 655362, 0, 131074, 655363, 0, 131074, 655364, 0, 131074, 655365, 0, 131074, 655366, 0, 131074, 655367, 0, 131074, 655368, 0, 131074, 655369, 0, 131074, 655370, 0, 131074, 655371, 0, 131074, 655372, 0, 131074, 655373, 0, 131074, 655374, 0, 131074, 655375, 0, 131074, 655376, 0, 131074, 655377, 0, 131074, 655378, 0, 131074, 655379, 0, 131074, 655380, 0, 131074, 655381, 0, 131075, 720896, 0, 131073, 720897, 0, 131074, 720898, 0, 131074, 720899, 0, 131074, 720900, 0, 131074, 720901, 0, 131074, 720902, 0, 131074, 720903, 0, 131074, 720904, 0, 131074, 720905, 0, 131074, 720906, 0, 131074, 720907, 0, 131074, 720908, 0, 131074, 720909, 0, 131074, 720910, 0, 131074, 720911, 0, 131074, 720912, 0, 131074, 720913, 0, 131074, 720914, 0, 131074, 720915, 0, 131074, 720916, 0, 131074, 720917, 0, 131075, 786432, 0, 131073, 786433, 0, 131074, 786434, 0, 131074, 786435, 0, 131074, 786436, 0, 131074, 786437, 0, 131074, 786438, 0, 131074, 786439, 0, 131074, 786440, 0, 131074, 786441, 0, 131074, 786442, 0, 131074, 786443, 0, 131074, 786444, 0, 131074, 786445, 0, 131074, 786446, 0, 131074, 786447, 0, 131074, 786448, 0, 131074, 786449, 0, 131074, 786450, 0, 131074, 786451, 0, 131074, 786452, 0, 131074, 786453, 0, 131075, 851968, 0, 131073, 851969, 0, 131074, 851970, 0, 131074, 851971, 0, 131074, 851972, 0, 131074, 851973, 0, 131074, 851974, 0, 131074, 851975, 0, 131074, 851976, 0, 131074, 851977, 0, 131074, 851978, 0, 131074, 851979, 0, 131074, 851980, 0, 131074, 851981, 0, 131074, 851982, 0, 131074, 851983, 0, 131074, 851984, 0, 131074, 851985, 0, 131074, 851986, 0, 131074, 851987, 0, 131074, 851988, 0, 131074, 851989, 0, 131075, 917504, 0, 196609, 917505, 0, 196610, 917506, 0, 196610, 917507, 0, 196610, 917508, 0, 196610, 917509, 0, 196610, 917510, 0, 196610, 917511, 0, 196610, 917512, 0, 196610, 917513, 0, 196610, 917514, 0, 196610, 917515, 0, 196610, 917516, 0, 196610, 917517, 0, 196610, 917518, 0, 196610, 917519, 0, 196610, 917520, 0, 196610, 917521, 0, 196610, 917522, 0, 196610, 917523, 0, 196610, 917524, 0, 196610, 917525, 0, 196611 ) +tile_data = PoolIntArray( 0, 0, 65537, 1, 0, 65538, 2, 0, 65538, 3, 0, 65538, 4, 0, 65538, 5, 0, 65538, 6, 0, 65538, 7, 0, 65538, 8, 0, 65538, 9, 0, 65538, 10, 0, 65538, 11, 0, 65538, 12, 0, 65538, 13, 0, 65538, 14, 0, 65538, 15, 0, 65538, 16, 0, 65538, 17, 0, 65538, 18, 0, 65538, 19, 0, 65538, 20, 0, 65538, 21, 0, 65539, 65536, 0, 131073, 65537, 0, 131074, 65538, 0, 131074, 65539, 0, 131074, 65540, 0, 131074, 65541, 0, 131074, 65542, 0, 131074, 65543, 0, 131074, 65544, 0, 131074, 65545, 0, 131074, 65546, 0, 131074, 65547, 0, 131074, 65548, 0, 131074, 65549, 0, 131074, 65550, 0, 131074, 65551, 0, 131074, 65552, 0, 131074, 65553, 0, 131074, 65554, 0, 131074, 65555, 0, 131074, 65556, 0, 131074, 65557, 0, 131075, 131072, 0, 131073, 131073, 0, 131074, 131074, 0, 131074, 131075, 0, 131074, 131076, 0, 131074, 131077, 0, 131074, 131078, 0, 131074, 131079, 0, 131074, 131080, 0, 131074, 131081, 0, 131074, 131082, 0, 131074, 131083, 0, 131074, 131084, 0, 131074, 131085, 0, 131074, 131086, 0, 131074, 131087, 0, 131074, 131088, 0, 131074, 131089, 0, 131074, 131090, 0, 131074, 131091, 0, 131074, 131092, 0, 131074, 131093, 0, 131075, 196608, 0, 131073, 196609, 0, 131074, 196610, 0, 131074, 196611, 0, 131074, 196612, 0, 131074, 196613, 0, 131074, 196614, 0, 131074, 196615, 0, 131074, 196616, 0, 131074, 196617, 0, 131074, 196618, 0, 131074, 196619, 0, 131074, 196620, 0, 131074, 196621, 0, 131074, 196622, 0, 131074, 196623, 0, 131074, 196624, 0, 131074, 196625, 0, 131074, 196626, 0, 131074, 196627, 0, 131074, 196628, 0, 131074, 196629, 0, 131075, 262144, 0, 131073, 262145, 0, 131074, 262146, 0, 131074, 262147, 0, 131074, 262148, 0, 131074, 262149, 0, 131074, 262150, 0, 131074, 262151, 0, 131074, 262152, 0, 131074, 262153, 0, 131074, 262154, 0, 131074, 262155, 0, 131074, 262156, 0, 131074, 262157, 0, 131074, 262158, 0, 131074, 262159, 0, 131074, 262160, 0, 131074, 262161, 0, 131074, 262162, 0, 131074, 262163, 0, 131074, 262164, 0, 131074, 262165, 0, 131075, 327680, 0, 131073, 327681, 0, 131074, 327682, 0, 131074, 327683, 0, 131074, 327684, 0, 131074, 327685, 0, 131074, 327686, 0, 131074, 327687, 0, 131074, 327688, 0, 131074, 327689, 0, 131074, 327690, 0, 131074, 327691, 0, 131074, 327692, 0, 131074, 327693, 0, 131074, 327694, 0, 131074, 327695, 0, 131074, 327696, 0, 131074, 327697, 0, 131074, 327698, 0, 131074, 327699, 0, 131074, 327700, 0, 131074, 327701, 0, 131075, 393216, 0, 131073, 393217, 0, 131074, 393218, 0, 131074, 393219, 0, 131074, 393220, 0, 131074, 393221, 0, 131074, 393222, 0, 131074, 393223, 0, 131074, 393224, 0, 131074, 393225, 0, 131074, 393226, 0, 131074, 393227, 0, 131074, 393228, 0, 131074, 393229, 0, 131074, 393230, 0, 131074, 393231, 0, 131074, 393232, 0, 131074, 393233, 0, 131074, 393234, 0, 131074, 393235, 0, 131074, 393236, 0, 131074, 393237, 0, 131075, 458752, 0, 131073, 458753, 0, 131074, 458754, 0, 131074, 458755, 0, 131074, 458756, 0, 131074, 458757, 0, 131074, 458758, 0, 131074, 458759, 0, 131074, 458760, 0, 131074, 458761, 0, 131074, 458762, 0, 131074, 458763, 0, 131074, 458764, 0, 131074, 458765, 0, 131074, 458766, 0, 131074, 458767, 0, 131074, 458768, 0, 131074, 458769, 0, 131074, 458770, 0, 131074, 458771, 0, 131074, 458772, 0, 131074, 458773, 0, 131075, 589822, 0, 262148, 524288, 0, 131073, 524289, 0, 131074, 524290, 0, 131074, 524291, 0, 131074, 524292, 0, 131074, 524293, 0, 131074, 524294, 0, 131074, 524295, 0, 131074, 524296, 0, 131074, 524297, 0, 131074, 524298, 0, 131074, 524299, 0, 131074, 524300, 0, 131074, 524301, 0, 131074, 524302, 0, 131074, 524303, 0, 131074, 524304, 0, 131074, 524305, 0, 131074, 524306, 0, 131074, 524307, 0, 131074, 524308, 0, 131074, 524309, 0, 131075, 589824, 0, 131073, 589825, 0, 131074, 589826, 0, 131074, 589827, 0, 131074, 589828, 0, 131074, 589829, 0, 131074, 589830, 0, 131074, 589831, 0, 131074, 589832, 0, 131074, 589833, 0, 131074, 589834, 0, 131074, 589835, 0, 131074, 589836, 0, 131074, 589837, 0, 131074, 589838, 0, 131074, 589839, 0, 131074, 589840, 0, 131074, 589841, 0, 131074, 589842, 0, 131074, 589843, 0, 131074, 589844, 0, 131074, 589845, 0, 131075, 655360, 0, 131073, 655361, 0, 131074, 655362, 0, 131074, 655363, 0, 131074, 655364, 0, 131074, 655365, 0, 131074, 655366, 0, 131074, 655367, 0, 131074, 655368, 0, 131074, 655369, 0, 131074, 655370, 0, 131074, 655371, 0, 131074, 655372, 0, 131074, 655373, 0, 131074, 655374, 0, 131074, 655375, 0, 131074, 655376, 0, 131074, 655377, 0, 131074, 655378, 0, 131074, 655379, 0, 131074, 655380, 0, 131074, 655381, 0, 131075, 720896, 0, 131073, 720897, 0, 131074, 720898, 0, 131074, 720899, 0, 131074, 720900, 0, 131074, 720901, 0, 131074, 720902, 0, 131074, 720903, 0, 131074, 720904, 0, 131074, 720905, 0, 131074, 720906, 0, 131074, 720907, 0, 131074, 720908, 0, 131074, 720909, 0, 131074, 720910, 0, 131074, 720911, 0, 131074, 720912, 0, 131074, 720913, 0, 131074, 720914, 0, 131074, 720915, 0, 131074, 720916, 0, 131074, 720917, 0, 131075, 786432, 0, 131073, 786433, 0, 131074, 786434, 0, 131074, 786435, 0, 131074, 786436, 0, 131074, 786437, 0, 131074, 786438, 0, 131074, 786439, 0, 131074, 786440, 0, 131074, 786441, 0, 131074, 786442, 0, 131074, 786443, 0, 131074, 786444, 0, 131074, 786445, 0, 131074, 786446, 0, 131074, 786447, 0, 131074, 786448, 0, 131074, 786449, 0, 131074, 786450, 0, 131074, 786451, 0, 131074, 786452, 0, 131074, 786453, 0, 131075, 851968, 0, 131073, 851969, 0, 131074, 851970, 0, 131074, 851971, 0, 131074, 851972, 0, 131074, 851973, 0, 131074, 851974, 0, 131074, 851975, 0, 131074, 851976, 0, 131074, 851977, 0, 131074, 851978, 0, 131074, 851979, 0, 131074, 851980, 0, 131074, 851981, 0, 131074, 851982, 0, 131074, 851983, 0, 131074, 851984, 0, 131074, 851985, 0, 131074, 851986, 0, 131074, 851987, 0, 131074, 851988, 0, 131074, 851989, 0, 131075, 917504, 0, 196609, 917505, 0, 196610, 917506, 0, 196610, 917507, 0, 196610, 917508, 0, 196610, 917509, 0, 196610, 917510, 0, 196610, 917511, 0, 196610, 917512, 0, 196610, 917513, 0, 196610, 917514, 0, 196610, 917515, 0, 196610, 917516, 0, 196610, 917517, 0, 196610, 917518, 0, 196610, 917519, 0, 196610, 917520, 0, 196610, 917521, 0, 196610, 917522, 0, 196610, 917523, 0, 196610, 917524, 0, 196610, 917525, 0, 196611 ) [node name="YSort" type="YSort" parent="."] @@ -58,7 +59,7 @@ position = Vector2( 200, 200 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="YSort/DoorCollision"] position = Vector2( 132.887, -159.68 ) -shape = SubResource( 4 ) +shape = SubResource( 1 ) [node name="DoorDetector" type="Area2D" parent="YSort"] collision_layer = 0 @@ -67,7 +68,7 @@ collision_mask = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="YSort/DoorDetector"] light_mask = 0 position = Vector2( 332.149, 29.4297 ) -shape = SubResource( 5 ) +shape = SubResource( 2 ) [node name="TreasureChest" parent="YSort" instance=ExtResource( 8 )] position = Vector2( 185, 215 ) @@ -161,28 +162,28 @@ position = Vector2( -17.4614, 141.279 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="wall"] position = Vector2( 363.748, -41.1679 ) -shape = SubResource( 1 ) +shape = SubResource( 3 ) [node name="wall1" type="StaticBody2D" parent="."] position = Vector2( 15.874, -26.1921 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="wall1"] position = Vector2( -3.71627, -0.261772 ) -shape = SubResource( 2 ) +shape = SubResource( 4 ) [node name="wall2" type="StaticBody2D" parent="."] position = Vector2( -7.93701, 71.8299 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="wall2"] position = Vector2( 8.36367, 26.9858 ) -shape = SubResource( 1 ) +shape = SubResource( 3 ) [node name="wall3" type="StaticBody2D" parent="."] position = Vector2( -49.6063, 34.526 ) [node name="CollisionShape2D" type="CollisionShape2D" parent="wall3"] position = Vector2( 0, -4.25 ) -shape = SubResource( 3 ) +shape = SubResource( 5 ) [node name="coin_container" type="Control" parent="."] margin_right = 40.0 @@ -223,5 +224,12 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="Effects" type="Node" parent="."] + +[node name="SlowTime" type="Node" parent="Effects"] +script = ExtResource( 16 ) + [connection signal="area_entered" from="YSort/DoorDetector" to="." method="_on_DoorDetector_area_entered"] [connection signal="ice_key_collected" from="YSort/TreasureChest" to="." method="_on_TreasureChest_ice_key_collected"] +[connection signal="frozen" from="YSort/Player" to="Effects/SlowTime" method="start"] +[connection signal="unfreeze" from="Effects/SlowTime" to="YSort/Player" method="_on_SlowTime_unfreeze"] diff --git a/Levels/SlowTime.gd b/Levels/SlowTime.gd new file mode 100644 index 0000000..2c3b239 --- /dev/null +++ b/Levels/SlowTime.gd @@ -0,0 +1,34 @@ +extends Node + +const END_VALUE = 1 + +signal unfreeze + +var is_active = false +var time_start +var duration_ms +var start_value + + + +func start(duration = 1, strength = 0.9): + time_start = OS.get_ticks_msec() + duration_ms = duration * 1000 + start_value = 1 - strength + Engine.time_scale = start_value + is_active = true + + +func _process(delta): + if is_active: + var current_time = OS.get_ticks_msec() - time_start + var value = circl_ease_in(current_time, start_value, END_VALUE, duration_ms) + if current_time >= duration_ms: + is_active = false + value = END_VALUE + emit_signal('unfreeze') + Engine.time_scale = value + +func circl_ease_in(t, b, c, d): + t /=d + return -c * (sqrt(1 - t * t) - 1) + b diff --git a/Player/Player.gd b/Player/Player.gd index 95da565..d7a0bae 100644 --- a/Player/Player.gd +++ b/Player/Player.gd @@ -3,6 +3,8 @@ extends KinematicBody2D export var ACCELERATION: int = 1000 export var MAX_SPEED: int = 120 export var FRICTION: int = 1000 +signal frozen + const HEALTH_SLICES: Array = [0, 18, 35, 50, 65, 82, 100] var health_index: int = 6 @@ -104,6 +106,9 @@ func _on_hitbox_area_entered(area: Area2D) -> void: hit = 2 elif area.is_in_group('enemy_hitbox_3') or area.is_in_group('enemy_projectile_3'): hit = 3 + elif area.is_in_group('freeze'): + emit_signal('frozen') + modulate = Color(0,.5,1) else: return #var timer = Timer.new() @@ -151,11 +156,12 @@ func _input(event: InputEvent) -> void: func _on_Hitbox_area_entered(area: Area2D) -> void: print(area.name) - if area.name.begins_with("coin"): - print("COIN") - if area.name == 'detection': return + + if 'freeze' in area.get_parent().get_groups(): + emit_signal('frozen') + return if 'enemies' in area.get_parent().get_groups() or area.name != 'detection' or 'damage' in area.get_groups(): if health_index != 0: @@ -164,3 +170,7 @@ func _on_Hitbox_area_entered(area: Area2D) -> void: else: get_tree().change_scene('res://Levels/Hub World.tscn') return + + +func _on_SlowTime_unfreeze() -> void: + modulate = Color(1,1,1) diff --git a/Player/Player.tscn b/Player/Player.tscn index 030126b..2fb00bc 100644 --- a/Player/Player.tscn +++ b/Player/Player.tscn @@ -182,7 +182,9 @@ graph_offset = Vector2( -3591.37, -302.6 ) [sub_resource type="AnimationNodeStateMachinePlayback" id=14] -[node name="Player" type="KinematicBody2D" groups=["player"]] +[node name="Player" type="KinematicBody2D" groups=[ +"player", +]] collision_layer = 2 script = ExtResource( 1 ) @@ -198,10 +200,12 @@ visible = false rotation = 1.5708 shape = SubResource( 2 ) -[node name="Hitbox" type="Area2D" parent="." groups=["player_hitbox"]] +[node name="Hitbox" type="Area2D" parent="." groups=[ +"player_hitbox", +]] +input_pickable = false collision_layer = 2 collision_mask = 4 -input_pickable = false [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] visible = false