Ghost enemy and other changes
This commit is contained in:
23
Enemies/Projectiles/Fireball.gd
Normal file
23
Enemies/Projectiles/Fireball.gd
Normal file
@@ -0,0 +1,23 @@
|
||||
extends Area2D
|
||||
|
||||
const SPEED: int = 200
|
||||
|
||||
var player_position: Vector2
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
|
||||
func init(spawn_position: Vector2, shoot_position: Vector2) -> void:
|
||||
position = spawn_position
|
||||
player_position = shoot_position
|
||||
velocity = position.direction_to(player_position).normalized() * SPEED
|
||||
$Sprite.rotation = player_position.angle_to_point(position) + deg2rad(180)
|
||||
return
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
position += velocity * delta
|
||||
return
|
||||
|
||||
|
||||
func _on_Lifetime_timeout():
|
||||
call_deferred('queue_free')
|
Reference in New Issue
Block a user