From 466bec0b724632f6dd2e1555a7bd58ffc1dd0458 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Mon, 20 Oct 2025 01:43:48 +0800 Subject: Jam version. --- Scripts/Weapons/Projectile.gd | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Scripts/Weapons/Projectile.gd (limited to 'Scripts/Weapons/Projectile.gd') 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() -- cgit v1.2.3