||Topic was automatically imported from the old Question2Answer platform.
||Published before Godot 3 was released.
I’m getting a null instance and I’m not sure why, it’s probably an order of operations problem that I just can’t seem to wrap my head around. One of you with a better understanding of when things actually take place when a Godot game launches will probably know immediately what I’m doing wrong.
when I run game, nothing happens but mana is increased continuously when click a circle image.
is it expected?
when click a circle, there is an error, and can be fixed by changing 2 lines of code.
var mana_total = 0 # instead of [var mana_total]
print("Mana total: ", mana_total) # instead of [print("Mana total: " + mana_total)]
and you’d better change
"user://" instead of
That helped a lot. In short, I’m trying to get it to save the mana_total. Upon closing and reopening the program, it fails to read the .dat file, which was apparently not written properly. Do you have any ideas regarding what I’m doing wrong there?
Daimoth | 2017-10-10 02:57
or problem to read / parse?
volzhs | 2017-10-10 05:15
Yes, it tells me there’s a UTF-8 error, or unicode error: invalid skip.
Try closing and opening the project again, it fails to load the mana_total value from the .dat file. Do you have any idea why this is the case? Thanks again, you’ve been a huge help.
Daimoth | 2017-10-10 14:17
it’s because you saved mana value by
but read it by
need to match same format.
file.get_float() instead of
file.get_as_text() is used with
volzhs | 2017-10-10 14:26
That led to a fix. Thank you!
Daimoth | 2017-10-10 17:28