Reorganize file structure of project
This commit is contained in:
17
Entities/Weapons/Projectiles/Scripts/base_projectile.gd
Normal file
17
Entities/Weapons/Projectiles/Scripts/base_projectile.gd
Normal file
@@ -0,0 +1,17 @@
|
||||
extends CharacterBody2D
|
||||
class_name BaseProjectile
|
||||
|
||||
@export var direction: Vector2
|
||||
@export var speed := 100
|
||||
|
||||
# Public Methods
|
||||
func SetProjectileStartAndDirection(start_position: Vector2, projectile_direction: Vector2) -> void:
|
||||
position = start_position
|
||||
direction = projectile_direction
|
||||
rotation = projectile_direction.angle()
|
||||
|
||||
|
||||
# Private Methods
|
||||
func _physics_process(delta: float) -> void:
|
||||
velocity = direction * speed * delta
|
||||
move_and_slide()
|
||||
Reference in New Issue
Block a user