AugGodotGameCourse/augustgamecourse/scripts/bullet.gd

19 lines
397 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("I done hit somethin")