pirate-survivors/GPE/CannonBall/cannon_ball.gd
Florian GOLESTIN 9028ec47cc initial commit
2026-01-17 14:36:11 +01:00

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()