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