When the level ends we give the player stars to rate their performance
Add a new HBoxContainer as a child of VBoxContainer
Rename it to Star Container
Add a TextureRect as a child of StarContainer
Add the Star.png image as the texture
Set Expand Mode to Fit Width
Set Stretch Mode to Keep Aspect Centered
Expand the Layout property
Set Custom Minimum to 128 x 128
Set Horizontal fill to Expand
Add a label as a child of VBoxContainer
Set Horizontal Alignment to Center
Set the text to Full Health + 1
Turn off visibility on the health label
Duplicate the HealthLabel
Set the text to Money money money + 1
Turn off visibility on the gold label
To hide and show stars in code we need access to them. In the VictoryLayer script.
Usually we use a ready variable and we could do that here but, because of the large scene tree the path is very long...
To maintain the naming convention
right click on the star in the scene tree
select % Access as Unique Name
Do this for Star2 and 3 as well
Now delete your previous long ready variable
Recreate your ready variables and see the difference:
To show the player that there are 3 stars to earn
Set the modulate property of Star2 and Star3 to black
We will give stars for the following:
1 Star for winning the level (Default star)
2 Stars for winning the level with full health
3 Stars for winning with 500 gold or more in the bank
To check health we need access to the Base
Access it via the group using a ready variable
To check gold we need access to the Bank
Access it via the group using a ready variable
We also need access to the health label and gold label
Right click on each of them and choose % Access as Unique Name
Then create onready variables for them
Create a victory function to display stars
based on our win conditions
Finally, in the enemy_path script
update the last line of the