july-game/scripts/bullet.gd

17 lines
355 B
GDScript3
Raw Normal View History

2025-08-12 01:03:09 +00:00
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)