+1 vote

So I'm trying to follow a tutorial but at the start I've already had a issue I'm trying to get a label to update with var.money as its a idle game, I'm confused all the code is a main script called homescript which labels all the
variables
var Money : 0
var Gems
var Producer1
var Producer1Raw
var Producer1Speed
var Producer1Roc
var Producer1MultT1
var Producer1MultT2
var Producer1MultT3
var Producer1MultT4
var Producer1MultT5
var Producer2
var Producer2Raw
var Producer2Speed
var Producer2Roc
var Producer2MultT1
var Producer2MultT2
var Producer2MultT3
var Producer2MultT4
var Producer2MultT5
var Producer3
var Producer3Raw
var Producer3Speed
var Producer3Roc
var Producer3MultT1
var Producer3MultT2
var Producer3MultT3
var Producer3MultT4
var Producer3MultT5
var Producer4
var Producer4Raw
var Producer4Speed
var Producer4Roc
var Producer4MultT1
var Producer4MultT2
var Producer4MultT3
var Producer4MultT4
var Producer4MultT5
var Producer5
var Producer5Raw
var Producer5Speed
var Producer5Roc
var Producer5MultT1
var Producer5MultT2
var Producer5MultT3
var Producer5MultT4
var Producer5MultT5

Then in the Store scene the code is:
func _ready():
$counter.text = "Cash: var.Money"

(the scene is just
Main Window
Store (Panel)
$counter (label)

Godot version 3.0
in Engine by (13 points)

1 Answer

0 votes

Here's the Store scene cleaned up.

func _ready():
    $counter.text = "Cash: " + str(Money)

Also, the variable Money needs to be changed to:

var Money: int = 0

May I suggest learning about GDScript and possibly the principles of object oriented programming.

by (3,162 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.