17 lines
355 B
GDScript3
17 lines
355 B
GDScript3
|
class_name Bullet extends Area2D
|
||
|
|
||
|
signal bulletHitSignal(body, bullet)
|
||
|
|
||
|
var SPEED: float = 700.0
|
||
|
|
||
|
func setSpeed(new_speed: float):
|
||
|
SPEED = new_speed
|
||
|
|
||
|
func _physics_process(delta: float) -> void:
|
||
|
position += transform.x * SPEED * delta
|
||
|
|
||
|
|
||
|
func _on_body_entered(body: Node2D) -> void:
|
||
|
if body.is_in_group("shootable"):
|
||
|
bulletHitSignal.emit(body, self)
|