2026-10-06 20:58:28 -04:00
|
|
|
class_name Bullet extends Area2D
|
|
|
|
|
|
|
|
|
|
var speed:= 700
|
|
|
|
|
signal bulletDamageSignal(body, bullet)
|
|
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
|
position += transform.x * speed * delta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
|
|
|
print("Bullet hit somethin")
|
|
|
|
|
bulletDamageSignal.emit(body, self)
|
2026-10-13 20:59:25 -04:00
|
|
|
|
|
|
|
|
func setSpeed(value)->void:
|
|
|
|
|
speed = value
|