add falling block
This commit is contained in:
parent
d6547b61d4
commit
54f0880864
20 changed files with 153 additions and 26 deletions
18
objects/environment/falling_block/falling_block.gd
Normal file
18
objects/environment/falling_block/falling_block.gd
Normal file
|
@ -0,0 +1,18 @@
|
|||
extends KinematicBody2D
|
||||
|
||||
var fall = false
|
||||
export var fall_speed = 0.5
|
||||
onready var startpos = position
|
||||
|
||||
func _physics_process(delta):
|
||||
if fall:
|
||||
position.y += fall_speed
|
||||
|
||||
func _on_Area2D_area_entered(area):
|
||||
if area.is_in_group("player"):
|
||||
fall = true
|
||||
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
position = startpos
|
||||
fall = false
|
Loading…
Add table
Add a link
Reference in a new issue