19 lines
381 B
GDScript
19 lines
381 B
GDScript
extends Area2D
|
|
@onready var BulletSprite: Sprite2D = $Sprite2D
|
|
|
|
var speed := 700
|
|
signal hit(bullet, body)
|
|
|
|
func setSpeed(speedVal):
|
|
speed = speedVal
|
|
if speedVal < 0:
|
|
BulletSprite.flip_h = true
|
|
else:
|
|
BulletSprite.flip_h = false
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
position += transform.x * speed * delta
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
print("Hit")
|