money systems

Started by mistral, Thu 13/04/2006 20:58:11

Previous topic - Next topic

mistral

 ???hi, im having trouble with adding a money system into my game, please can someone help me out with it, and yes i read the manual and the bfaq, thanx!! :=

DoorKnobHandle

What's the problem? Did you try it yet or don't you know how to start at all?

Just use variables (look them up in the manual) and if-statements as well as simple addition and subtraction to give or take money from or to the player and check whether he has enough to - for example - buy a certain item or whatever.

R4L

Well you could do this:

Use the GameScore for money. You could add score when you wanted and keep track of money pretty easily. Or:

You could use a varible. You would create a varible called cash, or whatever, then you set its value say 100 for 100 dollars. Then, if you wanted to display it on the GUI you could do this:

Code: ags
In repeatedly_execute in global script
string temp;
StrFormat(temp,"%d",GetGlobalInt(1));//one being cash
lblLabel.SetText(temp);//where lblLabel is the label name


This means that if you had a label 3, it will take the values of GI 1 and print it out to the label you request. since it's repeatedly execute, it will constantly update.

Hope I helped.

SMF spam blocked by CleanTalk