Start with a Container node to house our information
Add a MarginContainer node as a child
This will represent the money the player has
to spend on turrets and upgrades
At the top of the Viewport
Click on the Anchor Presets button
Click on the Margin Container
Expand the Theme Overrides property
Expand the Constants property
Set a 16px margin on all sides
The MarginContainer will be
in front of everything in our scene
to prevent it from interrupting mouse clicks
which could disrupt turret placement
Set Filter mode to ignore
Add a Label as a child of MarginContainer
Click on the Size Settings button
Next to the View button in the Viewport
add the word TEST as a placeholder
In the Label Settings Property
Add a new LabelSettings Object
Click on LabelSettings to expand it
Expand the Outline Property
Add a new script to the Bank
Add an export variable for starting gold
Add an onready variable to access the label
Create a set variable for the gold
Set gold to the parameter gold_in
Choose the biggest number between
gold_in and 0 and set that to gold
(This ensures gold cannot be negative)
Update the label to display current gold
In the ready function set gold to starting gold
So we have a way to access it from other scenes
In the RayPickerCamera Script
Add a ready variable to access the bank
Add an export variable to store the cost of the turrets
Check that there is enough gold to buy a turret
before changing the cursor to the placement hand
Once a turret has been placed
reduce the amount of gold in the bank
Gold is earned from destroying enemies
add an export variable to represent
the gold earned from an enemy
add a ready variable to gain access to the bank
update the gold in the bank with the value from the enemy
Change the cursor back from
This is done by adding an additional else statement
in the ray_picker_camera script