17 lines
329 B
GDScript
17 lines
329 B
GDScript
class_name Bullet extends Area2D
|
|
var speed = 700
|
|
|
|
signal bulletHit(body, bullet)
|
|
|
|
func setSpeed(value):
|
|
speed = value
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
position += transform.x * speed * delta
|
|
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if not body is Player:
|
|
print("Bullet hit")
|
|
bulletHit.emit(body, self)
|