Im new to Programming. Why isnt this shooting a bullet?

To my knowledge this should just work.

extends Area2D


func _physics_process(_delta):
	look_at(get_global_mouse_position())


func shoot():
	const BULLET = preload("res://bullet.tscn")
	var new_BULLET = BULLET.instantiate()
	new_BULLET.global_position = %Shooting_Point.global_position
	new_BULLET.global_rotation = %Shooting_Point.global_rotation
	%Shooting_Point.add_child(new_BULLET)

func Fire():
	if Input.is_action_pressed("Shoot"):
		shoot()
1 Like

There is a bunch of missing info here. Maybe post the scene tree and also format your code with the </> tool.

Fixed the Problem by just adding a timer and attaching the if statement into the signal from that to regulate firerate which wouldve been the next step.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.