added breakable blocks
This commit is contained in:
parent
886c7a7233
commit
1c540be7c3
3 changed files with 44 additions and 6 deletions
14
gmtk_2024/scripts/crumble.gd
Normal file
14
gmtk_2024/scripts/crumble.gd
Normal file
|
@ -0,0 +1,14 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
move_and_slide()
|
||||
if(get_slide_collision_count() > 0):
|
||||
for i in get_slide_collision_count():
|
||||
var box = get_slide_collision(i).get_collider() as Node2D
|
||||
if box.scale.x == 2:
|
||||
var timer = Timer.new()
|
||||
self.add_child(timer)
|
||||
timer.connect("timeout", queue_free)
|
||||
timer.set_wait_time(1)
|
||||
timer.start()
|
Loading…
Add table
Add a link
Reference in a new issue