added new type of falling block
This commit is contained in:
parent
05339e3ac1
commit
fe61dafe6c
8 changed files with 93 additions and 35 deletions
|
@ -8,6 +8,13 @@ onready var refresh_timer = $RefreshTimer
|
|||
onready var crush_area = $CrushArea
|
||||
onready var collision_shape = $CollisionShape2D
|
||||
onready var anims = $AnimationPlayer
|
||||
onready var sprite = $Sprite
|
||||
|
||||
func _ready():
|
||||
#Easy Mode
|
||||
if Game.is_easy_mode:
|
||||
fall_speed *= Game.easy_mode_speed_factor
|
||||
fall_timer.wait_time /= Game.easy_mode_speed_factor
|
||||
|
||||
func _physics_process(delta):
|
||||
#Fall
|
||||
|
@ -26,13 +33,15 @@ func _physics_process(delta):
|
|||
func _on_Area2D_area_entered(area):
|
||||
if area.is_in_group("player"):
|
||||
fall_timer.start()
|
||||
sprite.frame = 1
|
||||
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
position = startpos
|
||||
fall = false
|
||||
refresh_timer.stop()
|
||||
anims.play("disappear", -1, -1.0, true)
|
||||
#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
|
||||
|
@ -42,6 +51,7 @@ func _on_RefreshTimer_timeout():
|
|||
fall = false
|
||||
anims.play("idle")
|
||||
anims.play("disappear", -1, -1.0, true)
|
||||
sprite.frame = 0
|
||||
|
||||
func _on_FallTimer_timeout():
|
||||
fall = true
|
||||
|
@ -49,4 +59,5 @@ func _on_FallTimer_timeout():
|
|||
|
||||
|
||||
#func _on_Area2D_area_exited(area):
|
||||
# fall_timer.stop()
|
||||
# if area.is_in_group("player") && graphic == Graphics.GRAVEYARD:
|
||||
# sprite.frame = 0
|
||||
|
|
|
@ -52,6 +52,7 @@ fall_speed = 1.0
|
|||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
hframes = 2
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2( 4, 2.5 )
|
||||
|
@ -93,5 +94,6 @@ 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"]
|
|
@ -0,0 +1,9 @@
|
|||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://objects/environment/falling_block/falling_block_cave.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://graphics/falling_block/woeful_soul.png" type="Texture" id=2]
|
||||
|
||||
[node name="FallingBlock" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="Sprite" parent="." index="0"]
|
||||
texture = ExtResource( 2 )
|
Loading…
Add table
Add a link
Reference in a new issue