made falling blocks harder

This commit is contained in:
pennyrigate 2023-05-01 00:04:35 -04:00
parent afe7c35ea7
commit aa39838e16
2 changed files with 9 additions and 8 deletions

View file

@ -31,6 +31,8 @@ func _on_Area2D_area_entered(area):
func _on_VisibilityNotifier2D_screen_exited(): func _on_VisibilityNotifier2D_screen_exited():
position = startpos position = startpos
fall = false fall = false
refresh_timer.stop()
anims.play("disappear", -1, -1.0, true)
func _on_RefreshTimer_timeout(): func _on_RefreshTimer_timeout():
collision_shape.disabled = true # disable collision collision_shape.disabled = true # disable collision
@ -39,11 +41,12 @@ func _on_RefreshTimer_timeout():
collision_shape.call_deferred("set_disabled", false) collision_shape.call_deferred("set_disabled", false)
fall = false fall = false
anims.play("idle") anims.play("idle")
anims.play("disappear", -1, -1.0, true)
func _on_FallTimer_timeout(): func _on_FallTimer_timeout():
fall = true fall = true
refresh_timer.start() refresh_timer.start()
func _on_Area2D_area_exited(area): #func _on_Area2D_area_exited(area):
fall_timer.stop() # fall_timer.stop()

View file

@ -7,7 +7,7 @@
extents = Vector2( 4, 1.5 ) extents = Vector2( 4, 1.5 )
[sub_resource type="RectangleShape2D" id=2] [sub_resource type="RectangleShape2D" id=2]
extents = Vector2( 4, 0.5 ) extents = Vector2( 3.5, 0.5 )
[sub_resource type="RectangleShape2D" id=3] [sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 3, 0.5 ) extents = Vector2( 3, 0.5 )
@ -47,13 +47,13 @@ tracks/0/keys = {
[node name="FallingBlock" type="KinematicBody2D"] [node name="FallingBlock" type="KinematicBody2D"]
collision_layer = 4 collision_layer = 4
script = ExtResource( 2 ) script = ExtResource( 2 )
fall_speed = 1.0
[node name="Sprite" type="Sprite" parent="."] [node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 ) texture = ExtResource( 1 )
centered = false centered = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2( 4, 2.5 ) position = Vector2( 4, 2.5 )
shape = SubResource( 1 ) shape = SubResource( 1 )
@ -63,16 +63,15 @@ position = Vector2( 4, 4 )
scale = Vector2( 0.4, 0.4 ) scale = Vector2( 0.4, 0.4 )
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]
visible = false
collision_mask = 2 collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 4, -0.5 ) position = Vector2( 4, 0 )
shape = SubResource( 2 ) shape = SubResource( 2 )
[node name="FallTimer" type="Timer" parent="."] [node name="FallTimer" type="Timer" parent="."]
process_mode = 0 process_mode = 0
wait_time = 0.15 wait_time = 0.1
one_shot = true one_shot = true
[node name="RefreshTimer" type="Timer" parent="."] [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="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_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="FallTimer" to="." method="_on_FallTimer_timeout"]
[connection signal="timeout" from="RefreshTimer" to="." method="_on_RefreshTimer_timeout"] [connection signal="timeout" from="RefreshTimer" to="." method="_on_RefreshTimer_timeout"]