bug fix && plants

This commit is contained in:
Jonas Braus
2024-08-03 10:52:53 +02:00
parent 4a64f30c57
commit 7ece2c1391
8 changed files with 159 additions and 21 deletions
+35
View File
@@ -0,0 +1,35 @@
extends Area2D
var innocent = false
@onready var timer = $Timer
@onready var animated_sprite_2d = $AnimatedSprite2D
@onready var collision_shape_2d = $CollisionShape2D
var mover = 25
var up = false
func _on_body_entered(body):
if not innocent:
body.shrink()
innocent = true
timer.start()
func _process(delta):
if mover < 25:
collision_shape_2d.position.y += -1 if up else 1
animated_sprite_2d.position.y += -1 if up else 1
mover += 1
func _on_timer_timeout():
innocent = false
func move_up():
mover = 0
up = true
func move_down():
mover = 0
up = false
func f_die():
queue_free()