I have a node in my scene called Game (Node2D). This is the root of my scene.
Within the C# script (Game.cs) attached to this node I call a C# class named Song.
The Song class will call a Chord class and the Chord class will call a Note class....
Something like this:
mySong = new Song(this) // from Game.cs
....new Chord(game) // from Song.cs
....new Note(game). // from Chord.cs
From the Note class, I want to instantiate a sprite on my Game node.
The following works but if possible if you like to get ride of passing the game along these classes. I would like to kill the argument "Node2D game" from the constructors of the Song.cs, Chord.cs and Note.cs classes.
What can I do to the Note class to grab the Game node and do the same as below?
public Note(Node2D game)
// this works
this.game = game;
this.isvisible = true;
GD.Print("new note created !!");
newNote = (Sprite)icon.Instance();
newNote.SetPosition(new Vector2(RandomNumber(100,800),RandomNumber(100, 500)));
Thank you for your help