falling block has a delay before falling

This commit is contained in:
pennyrigate 2023-01-15 00:22:04 -05:00
parent 124b5e16aa
commit c3f32de2df
7 changed files with 216 additions and 40 deletions

File diff suppressed because one or more lines are too long

View file

@ -23,40 +23,44 @@ music = ExtResource( 12 )
position = Vector2( 128, 96 )
z_index = -2
texture = ExtResource( 8 )
__meta__ = {
"_edit_lock_": true
}
[node name="CanvasLayer" parent="." instance=ExtResource( 4 )]
[node name="Tentacle" parent="." instance=ExtResource( 3 )]
position = Vector2( 184, 152 )
[node name="FallingBlock" parent="." instance=ExtResource( 7 )]
position = Vector2( 56, 152 )
[node name="FallingBlock2" parent="." instance=ExtResource( 7 )]
position = Vector2( 72, 136 )
[node name="Ground" type="TileMap" parent="."]
tile_set = ExtResource( 2 )
cell_size = Vector2( 8, 8 )
collision_layer = 9
format = 1
tile_data = PoolIntArray( 1310725, 0, 0, 1376261, 0, 0, 1376268, 0, 262144, 1376274, 0, 262144, 1376284, 0, 262144, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 0, 1507329, 0, 0, 1507330, 0, 0, 1507331, 0, 0, 1507332, 0, 0, 1507333, 0, 0, 1507334, 0, 0, 1507335, 0, 0, 1507336, 0, 0, 1507337, 0, 0, 1507338, 0, 0, 1507339, 0, 0, 1507340, 0, 0, 1507341, 0, 0, 1507342, 0, 0, 1507343, 0, 0, 1507344, 0, 0, 1507345, 0, 0, 1507346, 0, 0, 1507347, 0, 0, 1507348, 0, 0, 1507349, 0, 0, 1507350, 0, 0, 1507351, 0, 0, 1507352, 0, 0, 1507353, 0, 0, 1507354, 0, 0, 1507355, 0, 0, 1507356, 0, 0, 1507357, 0, 0, 1507358, 0, 0, 1507359, 0, 0 )
tile_data = PoolIntArray( 1376268, 0, 262144, 1376274, 0, 262144, 1376284, 0, 262144, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 0, 1507329, 0, 0, 1507330, 0, 0, 1507331, 0, 0, 1507332, 0, 0, 1507333, 0, 0, 1507334, 0, 0, 1507335, 0, 0, 1507336, 0, 0, 1507337, 0, 0, 1507338, 0, 0, 1507339, 0, 0, 1507340, 0, 0, 1507341, 0, 0, 1507342, 0, 0, 1507343, 0, 0, 1507344, 0, 0, 1507345, 0, 0, 1507346, 0, 0, 1507347, 0, 0, 1507348, 0, 0, 1507349, 0, 0, 1507350, 0, 0, 1507351, 0, 0, 1507352, 0, 0, 1507353, 0, 0, 1507354, 0, 0, 1507355, 0, 0, 1507356, 0, 0, 1507357, 0, 0, 1507358, 0, 0, 1507359, 0, 0 )
[node name="Player" parent="." instance=ExtResource( 1 )]
position = Vector2( 32, 166 )
[node name="Ladder2" parent="." instance=ExtResource( 9 )]
position = Vector2( 136, 128 )
scale = Vector2( 1, 3 )
position = Vector2( 56, 104 )
scale = Vector2( 1, 5 )
[node name="Ladder3" parent="." instance=ExtResource( 9 )]
position = Vector2( 80, 104 )
scale = Vector2( 1, 4 )
[node name="Ladder" type="TileMap" parent="."]
tile_set = ExtResource( 2 )
cell_size = Vector2( 8, 8 )
collision_layer = 9
format = 1
tile_data = PoolIntArray( 1048593, 0, 196608, 1114129, 0, 196608, 1179665, 0, 196608, 1376268, 0, 262144, 1376274, 0, 262144, 1376284, 0, 262144, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 0, 1507329, 0, 0, 1507330, 0, 0, 1507331, 0, 0, 1507332, 0, 0, 1507333, 0, 0, 1507334, 0, 0, 1507335, 0, 0, 1507336, 0, 0, 1507337, 0, 0, 1507338, 0, 0, 1507339, 0, 0, 1507340, 0, 0, 1507341, 0, 0, 1507342, 0, 0, 1507343, 0, 0, 1507344, 0, 0, 1507345, 0, 0, 1507346, 0, 0, 1507347, 0, 0, 1507348, 0, 0, 1507349, 0, 0, 1507350, 0, 0, 1507351, 0, 0, 1507352, 0, 0, 1507353, 0, 0, 1507354, 0, 0, 1507355, 0, 0, 1507356, 0, 0, 1507357, 0, 0, 1507358, 0, 0, 1507359, 0, 0 )
tile_data = PoolIntArray( 851975, 0, 196608, 851978, 0, 196608, 917511, 0, 196608, 917514, 0, 196608, 983047, 0, 196608, 983050, 0, 196608, 1048583, 0, 196608, 1048586, 0, 196608, 1048593, 0, 196608, 1114119, 0, 196608, 1114129, 0, 196608, 1179665, 0, 196608, 1376268, 0, 262144, 1376274, 0, 262144, 1376284, 0, 262144, 1441792, 0, 0, 1441793, 0, 0, 1441794, 0, 0, 1441795, 0, 0, 1441796, 0, 0, 1441797, 0, 0, 1441798, 0, 0, 1441799, 0, 0, 1441800, 0, 0, 1441801, 0, 0, 1441802, 0, 0, 1441803, 0, 0, 1441804, 0, 0, 1441805, 0, 0, 1441806, 0, 0, 1441807, 0, 0, 1441808, 0, 0, 1441809, 0, 0, 1441810, 0, 0, 1441811, 0, 0, 1441812, 0, 0, 1441813, 0, 0, 1441814, 0, 0, 1441815, 0, 0, 1441816, 0, 0, 1441817, 0, 0, 1441818, 0, 0, 1441819, 0, 0, 1441820, 0, 0, 1441821, 0, 0, 1441822, 0, 0, 1441823, 0, 0, 1507328, 0, 0, 1507329, 0, 0, 1507330, 0, 0, 1507331, 0, 0, 1507332, 0, 0, 1507333, 0, 0, 1507334, 0, 0, 1507335, 0, 0, 1507336, 0, 0, 1507337, 0, 0, 1507338, 0, 0, 1507339, 0, 0, 1507340, 0, 0, 1507341, 0, 0, 1507342, 0, 0, 1507343, 0, 0, 1507344, 0, 0, 1507345, 0, 0, 1507346, 0, 0, 1507347, 0, 0, 1507348, 0, 0, 1507349, 0, 0, 1507350, 0, 0, 1507351, 0, 0, 1507352, 0, 0, 1507353, 0, 0, 1507354, 0, 0, 1507355, 0, 0, 1507356, 0, 0, 1507357, 0, 0, 1507358, 0, 0, 1507359, 0, 0 )
[node name="Death" type="TileMap" parent="."]
tile_set = ExtResource( 5 )
cell_size = Vector2( 8, 8 )
format = 1
[node name="FallingBlock" parent="." instance=ExtResource( 7 )]
position = Vector2( 40, 160 )

View file

@ -25,7 +25,6 @@ func _physics_process(delta):
else: move_up_and_down(delta)
#Speed up if in raycast
if raycast.get_collider() != null:
Debug.print(raycast.get_collider())
if raycast.get_collider().is_in_group("player"):
go_fast = true
timer.set_wait_time(0.5)

View file

@ -38,7 +38,6 @@ move_speed = 50.0
material = SubResource( 5 )
position = Vector2( 0, 1 )
frames = SubResource( 3 )
frame = 1
playing = true
[node name="Hitbox" type="Area2D" parent="." index="1"]

View file

@ -3,16 +3,27 @@ extends KinematicBody2D
var fall = false
export var fall_speed = 0.5
onready var startpos = position
onready var timer = $Timer
func _physics_process(delta):
if fall:
position.y += fall_speed
Debug.print($Timer.get_time_left())
func _on_Area2D_area_entered(area):
if area.is_in_group("player"):
fall = true
$Timer.start()
func _on_VisibilityNotifier2D_screen_exited():
position = startpos
fall = false
func _on_Timer_timeout():
fall = true
func _on_Area2D_area_exited(area):
$Timer.stop()

View file

@ -35,5 +35,11 @@ collision_mask = 2
position = Vector2( 4, -0.5 )
shape = SubResource( 2 )
[node name="Timer" type="Timer" parent="."]
wait_time = 0.15
one_shot = true
[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="Timer" to="." method="_on_Timer_timeout"]

View file

@ -21,19 +21,20 @@ script = ExtResource( 3 )
[node name="Sprite" type="Sprite" parent="."]
material = SubResource( 1 )
position = Vector2( 0, -1 )
position = Vector2( -1, -1 )
texture = ExtResource( 1 )
centered = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 5, 3.5 )
position = Vector2( 4, 3.5 )
shape = SubResource( 2 )
[node name="Area2D" type="Area2D" parent="." groups=["squash"]]
position = Vector2( -1, 0 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2( 5, 3.5 )
shape = SubResource( 3 )
[node name="Bottom" type="Position2D" parent="."]
position = Vector2( 5, 8 )
position = Vector2( 4, 8 )