From aa39838e16e907ab754de8132f5d114d127a59d3 Mon Sep 17 00:00:00 2001 From: pennyrigate Date: Mon, 1 May 2023 00:04:35 -0400 Subject: [PATCH] made falling blocks harder --- objects/environment/falling_block/falling_block.gd | 7 +++++-- objects/environment/falling_block/falling_block.tscn | 10 ++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/objects/environment/falling_block/falling_block.gd b/objects/environment/falling_block/falling_block.gd index eed6938..ae7f17d 100644 --- a/objects/environment/falling_block/falling_block.gd +++ b/objects/environment/falling_block/falling_block.gd @@ -31,6 +31,8 @@ func _on_Area2D_area_entered(area): func _on_VisibilityNotifier2D_screen_exited(): position = startpos fall = false + refresh_timer.stop() + anims.play("disappear", -1, -1.0, true) func _on_RefreshTimer_timeout(): collision_shape.disabled = true # disable collision @@ -39,11 +41,12 @@ func _on_RefreshTimer_timeout(): collision_shape.call_deferred("set_disabled", false) fall = false anims.play("idle") + anims.play("disappear", -1, -1.0, true) func _on_FallTimer_timeout(): fall = true refresh_timer.start() -func _on_Area2D_area_exited(area): - fall_timer.stop() +#func _on_Area2D_area_exited(area): +# fall_timer.stop() diff --git a/objects/environment/falling_block/falling_block.tscn b/objects/environment/falling_block/falling_block.tscn index bbdc35c..83a8306 100644 --- a/objects/environment/falling_block/falling_block.tscn +++ b/objects/environment/falling_block/falling_block.tscn @@ -7,7 +7,7 @@ extents = Vector2( 4, 1.5 ) [sub_resource type="RectangleShape2D" id=2] -extents = Vector2( 4, 0.5 ) +extents = Vector2( 3.5, 0.5 ) [sub_resource type="RectangleShape2D" id=3] extents = Vector2( 3, 0.5 ) @@ -47,13 +47,13 @@ tracks/0/keys = { [node name="FallingBlock" type="KinematicBody2D"] collision_layer = 4 script = ExtResource( 2 ) +fall_speed = 1.0 [node name="Sprite" type="Sprite" parent="."] texture = ExtResource( 1 ) centered = false [node name="CollisionShape2D" type="CollisionShape2D" parent="."] -visible = false position = Vector2( 4, 2.5 ) shape = SubResource( 1 ) @@ -63,16 +63,15 @@ position = Vector2( 4, 4 ) scale = Vector2( 0.4, 0.4 ) [node name="Area2D" type="Area2D" parent="."] -visible = false collision_mask = 2 [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] -position = Vector2( 4, -0.5 ) +position = Vector2( 4, 0 ) shape = SubResource( 2 ) [node name="FallTimer" type="Timer" parent="."] process_mode = 0 -wait_time = 0.15 +wait_time = 0.1 one_shot = true [node name="RefreshTimer" type="Timer" parent="."] @@ -94,6 +93,5 @@ anims/idle = SubResource( 5 ) [connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"] [connection signal="area_entered" from="Area2D" to="." method="_on_Area2D_area_entered"] -[connection signal="area_exited" from="Area2D" to="." method="_on_Area2D_area_exited"] [connection signal="timeout" from="FallTimer" to="." method="_on_FallTimer_timeout"] [connection signal="timeout" from="RefreshTimer" to="." method="_on_RefreshTimer_timeout"]