Be a Supporter!

Money system help.

  • 238 Views
  • 3 Replies
New Topic Respond to this Topic
drip
drip
  • Member since: Dec. 5, 2004
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Money system help. 2009-02-25 10:15:57 Reply

Sup guys, I just have a few questions as I'm starting to get back into coding; My brain is a little slow atm so bare with me as I am also doing this in AS2.

I'm creating an expressive game about New England fishermen and I have it so there are different hot spots around the coast where you can fish. I have it so that when you position the boat above a hot spot it pulls a random movie clip from an array to tell you how many fish you have caught in this spot. I have it so it adds that amount to you cargo hold.

Now this is where my problem comes in, when you bring the boat back to the dock to exchange your catch for money, I have it so it takes the cargo hold total and multiplies it by 100 and empties the cargo hold. This all works fine until you bring back another load as to where instead of adding the past amount of money you have to the amount you just received for this haul, it replaces your past money for the new amount.

I was wondering if I would have to make a new variable that stores the old amount of money you made and have the new money you make from future hauls add to it? And if so how?

TVK
TVK
  • Member since: Jan. 20, 2005
  • Offline.
Forum Stats
Member
Level 13
Programmer
Response to Money system help. 2009-02-25 10:25:46 Reply

Doesn't something like this work?

money += (cargoHold * 100);

If not, could you post some code where the problem occurs?

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to Money system help. 2009-02-25 10:26:21 Reply

At 2/25/09 10:15 AM, drip wrote: I was wondering if I would have to make a new variable that stores the old amount of money you made and have the new money you make from future hauls add to it? And if so how?

If you can program that other stuff I'm surprised you're having trouble with this. Simply have two variables, totalCash and tripCash, which both start at 0. When out fishing, add to tripCash. Back at port, add tripCash to totalCash and reset tripCash to zero


- - Flash - Music - Images - -

BBS Signature
drip
drip
  • Member since: Dec. 5, 2004
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to Money system help. 2009-02-25 10:43:07 Reply

Thanks guys got it working now.

Ya, I was surprised too that I could handle all that other coding but this just stumped me for some reason...a very humbling brain fart.