2024-09-09 21:27:42 +00:00
|
|
|
class_name Bullet extends Area2D
|
2024-07-16 01:10:20 +00:00
|
|
|
|
|
|
|
var speed = 750
|
2024-09-09 21:27:42 +00:00
|
|
|
signal hit(bullet, body)
|
2024-07-16 01:10:20 +00:00
|
|
|
|
|
|
|
func setSpeed(speedVal):
|
|
|
|
speed = speedVal
|
|
|
|
|
|
|
|
func _physics_process(delta):
|
|
|
|
position += transform.x * speed * delta
|
|
|
|
|
|
|
|
func _on_body_entered(body):
|
|
|
|
print("bullet hit something")
|
2024-07-29 18:23:06 +00:00
|
|
|
|
2024-07-16 01:10:20 +00:00
|
|
|
if not body.is_in_group("player"):
|
2024-09-09 21:27:42 +00:00
|
|
|
hit.emit(self, body)
|
|
|
|
|