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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue