diff options
author | altaf-creator <dev@altafcreator.com> | 2025-10-20 01:43:48 +0800 |
---|---|---|
committer | altaf-creator <dev@altafcreator.com> | 2025-10-20 01:43:48 +0800 |
commit | 466bec0b724632f6dd2e1555a7bd58ffc1dd0458 (patch) | |
tree | d6645ea11914edeec645299fa497a9e542dbaec7 /Scripts/Weapons/Projectile.gd |
Jam version.
Diffstat (limited to 'Scripts/Weapons/Projectile.gd')
-rw-r--r-- | Scripts/Weapons/Projectile.gd | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Scripts/Weapons/Projectile.gd b/Scripts/Weapons/Projectile.gd new file mode 100644 index 0000000..fa13c70 --- /dev/null +++ b/Scripts/Weapons/Projectile.gd @@ -0,0 +1,19 @@ +extends RigidBody2D + +@export var init_vel : Vector2 +@export var sprite : Node2D +@export var atk : int + +func _ready() -> void: + linear_velocity = init_vel + print(linear_velocity.normalized()) + +func _process(delta: float) -> void: + var normalised = linear_velocity.normalized() + sprite.rotation = atan2(normalised.y, normalised.x) + +func _on_area_2d_body_entered(body:Node2D) -> void: + print(body) + if body is Entity: + body.damage(atk) + queue_free() |