15 lines
524 B
GDScript
15 lines
524 B
GDScript
class_name Enemy
|
|
extends Node2D
|
|
|
|
@export var shoot_speed = Vector2.ZERO
|
|
@export var shoot_variance = Vector2.ZERO
|
|
@export var projectile = preload("res://objects/projectile/enemy_projectile.tscn")
|
|
@export var move_speed = 0.0
|
|
|
|
func shoot(pos):
|
|
var Projectile = projectile.instantiate()
|
|
Projectile.speed.x = shoot_speed.x + randf_range(-shoot_variance.x,shoot_variance.x)
|
|
Projectile.speed.y = shoot_speed.y + randf_range(-shoot_variance.y,shoot_variance.y)
|
|
Projectile.position = pos
|
|
get_parent().add_child(Projectile)
|
|
|