blob: fa13c70157f0adfa9e0f8fd5b9575fd0a1f36227 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()
|