20 lines
448 B
GDScript
20 lines
448 B
GDScript
extends Area2D
|
|
|
|
|
|
|
|
@export var speed: float = 200.0
|
|
@export var damage: int = 10
|
|
|
|
func _ready():
|
|
# Déplace la balle dans la direction de sa rotation
|
|
#var velocity = Vector2(speed, 0).rotated(rotation)
|
|
connect("body_entered", _on_body_entered)
|
|
|
|
func _physics_process(delta: float):
|
|
position += Vector2(speed, 0).rotated(rotation) * delta
|
|
|
|
func _on_body_entered(body):
|
|
if body.has_method("take_damage"):
|
|
body.take_damage(damage)
|
|
queue_free()
|