I am trying to create a scene where I spawn instances of a scene that send a signal once they connect. Think of something like Crossyroad or Frogger.
I have the following setup:
A player scene that has a KinematicBody2D with a sprite and a collisionshape (and some code to move it)
An enemy scene that where an Area2D is the root node and it has a sprite and a collisionshape2D as well and in the code I have:
func _ process(delta):
position.x -= 5
(I move the parent node to the right edge of the viewport).
Finally, there is a main scene where I try to connect them, it just has a plain Node, an instance of the Player and a timer that emits the timeout() signal every 2 seconds, the code on the script looks like this:
const new_enemy = preload("res://Enemy.tscn")
var enemy = new_enemy.instance()
When I run the scene and the player touches the enemy I get the error message:
Error calling method from signal 'body_entered':'Viewpoert::test_function': Method not found
I am mostly confused about the .connect("signal",node,"function"). Would really appreciate if someone could explain where I went wrong.