15 lines
354 B
GDScript
15 lines
354 B
GDScript
class_name Bullet extends Area2D
|
|
var speed:float = 700
|
|
signal bulletHitSignal(body, bullet)
|
|
func setSpeed(value)->void:
|
|
speed = value
|
|
|
|
func _process(delta: float) -> void:
|
|
position += transform.x * speed * delta
|
|
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
if body.is_in_group("shootable"):
|
|
print("bullet hit!")
|
|
bulletHitSignal.emit(body,self)
|