Hi,
Anyone can help me with a function?
I try create function to buy buildings in my prototype game.
For example:
I have a global variable called GOLD, then I have buildings, each have a VarCoast variable ...
Building1 - VarCoast = 1000
Building2 - VarCoast = 500
Building3 - VarCoast = 2000
...
I want to create a function to subtract gold from my GOLD global variable.
I try this:
<font color=blue>
- Mouse On left button Clicked on Bulding 1 >> Function Call "Buy"(VarCoast)
...
- GOLD => param(Varcoast) >> Subtract (VarCoast) from GOLD
</font>
<font color=red>
BUT... How I get VarCoast to subtract to my global variablo GOLD?
</font>
I make this easily without make function. But I have to repeat the code for each building. I think a function let the code cleaner.
Got the point?