Shooting projectiles :: Godot 4 Recipes

PHOTO EMBED

Wed Jan 10 2024 18:55:06 GMT+0000 (Coordinated Universal Time)

Saved by @Hammy711

extends Area2D



var speed = 750



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()
content_copyCOPY

https://kidscancode.org/godot_recipes/4.x/2d/2d_shooting/index.html