The function signature doesn't match the parent. Parent signature is :"void _process(float)"

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By coderperson

I keep getting this error. Whenever I add another argument to the gun and player script, which both are parents, I get the error on them. The only scripts i have are the bullet, the script I am currently having the error in and the gun and player script which are parents of it.

Heres my code:

extends KinematicBody2D

func _ready():
position = Vector2(-93,-18.666)
func fire(bullet,angle):
var direction = Vector2(1.0,0.0).rotated(angle).normalized()
bullet.direction = direction
get_parent().add_child(bullet)
var direction = Vector2(1.0,0.0)
var speed = 500

func _process(bullet,angle):
fire(bullet,angle)
position = position + speed * direction * delta * -1

I’m not sure I understand what you’re trying to do. The _process() function is a built-in engine function that has a specific signature - as indicated in the error message. That needs to look like:

proc _process(delta):
    # code here

You can’t arbitrarily add additional arguments to it. Though, you shouldn’t need to. Perhaps explain what you’re trying to do here and a better suggestion can be offered.

jgodfrey | 2023-03-03 23:03

FYI - I just hid the inadvertent duplicate post.

jgodfrey | 2023-03-03 23:04

Hello, thank you for answering. I am trying to create a bullet. When you use the left mouse button to shoot, which I have already mapped on the input map, it will fire. The error happens in pretty much all of my code, but I was able to find a different way there, but not here. Also in my code after the process I meant to add if Input.action_press(“shoot”):

coderperson | 2023-03-04 12:30

I has able to figure out, all i needed was just delta. I feel so dumb right now.

coderperson | 2023-03-05 14:55