Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Kiren |
Hi all,
i have a function that add value to a variable and another variable that is the sum of 2 variables.
When i use the function to add value the value isn’t stored correctly and i can’t figure why.
Here are the variables and the function:
var damage = 1
var attdam = 1
var total_damage = damage + attdam
func buy_attdam():
attdam = attdam + 1
and here the full code on Pastebin:
Someone can kindly explain why the total_damage variable stays always at value = 2 even if i use the function buy_attdam? Thank you