Calling a method in a script

Godot version 4

Im making my first game, a flappy bird type game, using godot in C# and I made a script that clones pipes and makes them move left but I’m having trouble calling the process at all, this process would affect the clone

using Godot;
using System;
using System.Collections;
public partial class Pipe1 : Sprite2D
{
private Node2D cloned;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
}
private void _on_timer_timeout()
{
SceneTree sceneTree = GetTree();
PackedScene origScene =
GD.Load<PackedScene(“res://flappyWappy.tscn”);
cloned = (Node2D)this.Duplicate();
sceneTree.Root.AddChild(cloned);
cloned.Connect(_OnPipeProcess);
}
private void _OnPipeProcess(float delta)
{
cloned.Position += new Vector2(-1 * delta * 25, 0);
}
// Called every frame. ‘delta’ is the elapsed time since the previous frame.
public override void _Process(double delta)
{
}
}

I want to call this method for the clones

private void _OnPipeProcess(float delta)
{
cloned.Position += new Vector2(-1 * delta * 25, 0);
}

this returns an error

cloned.Connect(_OnPipeProcess);

Firstly: What error does cloned.Connect(_OnPipeProcess); return?
Seconldy: are you sure you are calling _OnPipeProcess(float delta) at some point? Most of the time something doesn’t work on my game, I forgot to call a method.

Please format your code with the </> tool.

I’m not quite sure as I’ve scrapped the script but the second part sounds helpful, how do I call a method?

Can you provide your thoughts? I need more content to provide you with suggestions.

We need to know what error is returned by cloned.Connect(_OnPipeProcess);. There could be a million things wrong

this error:

CS7036: There is no argument given that corresponds to the required parameter ‘callable’ of ‘GodotObject.Connect(StringName, Callable, uint)’ E:\GodotProjects\Pipe1.cs(24,10)

im trying to make a flappy bird game and make it so that when the pipe is cloned it continuously moves through to the the edge of the left screen

I think if I use Instantiate a new scene with the pipe moving instead of using the duplicate method I could achieve the same effect

I think I can help you now.
You are using the method wrong. If you read the docs, you will see, that you need to provide the signal name, as well as a method, wich will be called.

So you need to write something like

cloned.connect("SignalNameYouNeed", _OnPipeProcess);

I don’t know which signal you want to connect to and I can’t figure out what you are trying to accomplish based on the code you provided.

Additionally godot supports the C# way of handling signals via the += and -= operators. There are docs on that topic to. Just look for ‘C# events’.

Ok, I need to clarify a few concepts first. The pipeline is rendered within the screen, so you can first instantiate a certain number of pipelines, such as 16? Then when the bird moves, you only need to change the position of each pipeline.

Yeah thats possible. It seems like you already instantiate your nodes. The movement of the pipes shouldn’t be too hard. You could just offset the position of the pipe each frame _OnProcess.