added fireballs
This commit is contained in:
@@ -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")
|
||||
Reference in New Issue
Block a user