added fireballs

This commit is contained in:
Jonas Braus
2024-07-29 23:30:26 +02:00
parent 3a6f8517c0
commit 85736f82e0
19 changed files with 365 additions and 39 deletions
+9
View File
@@ -0,0 +1,9 @@
extends Area2D
@onready var animation_player = $AnimationPlayer
func collect_coin(body):
body.increase_coins()
animation_player.play("pickup")
func _on_body_entered(body):
collect_coin(body)
+6
View File
@@ -0,0 +1,6 @@
extends Area2D
@onready var animation_player = $AnimationPlayer
func _on_body_entered(body):
body.flower()
animation_player.play("pickup")
+23
View File
@@ -0,0 +1,23 @@
extends RigidBody2D
@onready var timer = $Timer
var enter_count = 0
# Called when the node enters the scene tree for the first time.
func _ready():
timer.start()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_timer_timeout():
queue_free()
func _on_area_2d_body_entered(body):
enter_count += 1
if enter_count > 2:
queue_free()
func _on_enemie_die_body_entered(body):
body.f_die()
queue_free()
+20
View File
@@ -0,0 +1,20 @@
extends RigidBody2D
@export var speed = 70
@onready var ray_cast_left = $RayCastLeft
@onready var ray_cast_right = $RayCastRight
@onready var animation_player = $AnimationPlayer
func _physics_process(delta):
linear_velocity.x = speed
if ray_cast_left.is_colliding():
speed = abs(speed)
elif ray_cast_right.is_colliding():
speed = abs(speed) * -1
func _on_area_2d_body_entered(body):
body.grow()
speed = 0
animation_player.play("pickup")