diff --git a/MainScript.cs b/MainScript.cs index cbe78b7..ef9aa99 100644 --- a/MainScript.cs +++ b/MainScript.cs @@ -15,6 +15,7 @@ public partial class MainScript : Node2D private Dictionary _stars = new Dictionary(); private List _scenes = new List(); + private Sprite2D _background = null; // Called when the node enters the scene tree for the first time. public override void _Ready() @@ -78,6 +79,13 @@ public partial class MainScript : Node2D this._stars.Clear(); + Image bgImage = Image.LoadFromFile("resources/" + obj_conf.background); + ImageTexture bgTexture = ImageTexture.CreateFromImage(bgImage); + this._background = new Sprite2D(); + this._background.SetTexture(bgTexture); + projection.AddChild(this._background); + this._background.ZIndex = 4; + foreach (StarConfig star_config in obj_conf.stars) { Sprite2D sprite = new Sprite2D(); @@ -105,6 +113,8 @@ public partial class MainScript : Node2D child.QueueFree(); } + + foreach (KeyValuePair star in this._stars) { projection.AddChild(star.Value.Sprite);