KieranGodot/august26godotcompkieran/Sripts/bullet.gd

19 lines
381 B
GDScript3
Raw Permalink Normal View History

2024-09-10 01:02:15 +00:00
extends Area2D
@onready var BulletSprite: Sprite2D = $Sprite2D
2024-09-10 01:02:15 +00:00
var speed := 700
signal hit(bullet, body)
func setSpeed(speedVal):
speed = speedVal
if speedVal < 0:
BulletSprite.flip_h = true
else:
BulletSprite.flip_h = false
2024-09-10 01:02:15 +00:00
func _physics_process(delta: float) -> void:
position += transform.x * speed * delta
func _on_body_entered(body: Node2D) -> void:
print("Hit")