GodotCourse/examples/PlatformTemplate/scenes/bullet.gd

22 lines
366 B
GDScript3
Raw Permalink Normal View History

2024-07-15 12:00:42 +00:00
extends Area2D
var speed = 750
func setSpeed(speedVal):
speed = speedVal
func _physics_process(delta):
position += transform.x * speed * delta
func _on_Bullet_body_entered(body):
if body.is_in_group("mobs"):
body.queue_free()
queue_free()
func _on_body_entered(body):
# blast the body?
if body.is_in_group("boxes"):
body.queue_free()
queue_free()