Added locked barriers and a new ghost enemy

This commit is contained in:
VoidTwo
2021-12-04 18:23:05 -06:00
parent fcea3cee03
commit 9101bf2f65
21 changed files with 472 additions and 41 deletions

View File

@@ -0,0 +1,28 @@
extends Area2D
const SPEED: int = 35
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
$Sprite.rotation = player_position.angle_to_point(position) + deg2rad(90)
return
func _physics_process(delta: float) -> void:
velocity = Vector2.ZERO
if position.distance_to(player_position) > 1:
velocity = position.direction_to(player_position).normalized() * SPEED * delta
position += velocity
return
func _on_tifetime_timeout() -> void:
call_deferred('queue_free')
return