Godot 4.3
I currently have a bullet system set up to try and make the bullet scene spawn and instantiate when the action is pressed. But it doesn’t seem to work properly.
PLAYER CODE:
func _process(delta):
if Input.is_action_just_pressed(“bullet”):
bullet()
func bullet():
var bullet = Bullet
owner.add_child(bullet)
bullet.transform = $bulletspawn.global_transform
BULLET CODE:
class_name Bullet 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(“enemy”):
body.queue_free()
queue_free()