19 lines
353 B
GDScript
19 lines
353 B
GDScript
class_name Bullet extends Area2D
|
|
|
|
|
|
var speed:float = 700
|
|
signal bulletDamageSignal(body,bullet)
|
|
|
|
func setSpeed(value:float):
|
|
speed = value
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
position += transform.x * speed * delta
|
|
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
|
|
if body.is_in_group("shootables"):
|
|
|
|
bulletDamageSignal.emit(body,self)
|