class_name TimeGhost extends "res://scenes/spaceShip/spaceShip.gd"

@onready var damageArea = $DamageArea

@export var spaceShip: Spaceship = null


#func _init(_speed: int, _acceleration: float) -> void:
#	speed = _speed
	#acceleration = _acceleration


func _physics_process(delta: float) -> void:
	move_and_slide()

func setSpaceship(_spaceShip: Spaceship):
	spaceShip = _spaceShip
	speed = spaceShip.speed
	acceleration = spaceShip.acceleration
	global_position = spaceShip.global_position
	sprite.texture = spaceShip.sprite.texture


func _on_damage_area_area_entered(area: Area2D) -> void:
	if area.get_parent().is_in_group("player"):
		damageArea.damageHurtArea(area, Globals.getPlayer().maxHealth)
