A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Can't add with a constantly changing variable

Threaded View

  1. #1
    Junior Member
    Join Date
    May 2010

    Question Can't add with a constantly changing variable

    Okay, so:

    I am making a game in flash, that uses several resources to build different buildings, that help you to gain resources, etc. I'm trying to make it so that the more "_global.food" you have, the faster your resources will go up. I have it so that the variable "_global.woodBoostMeter" goes up as fast as "_global.woodBoostSpeed" and when it reaches 500, it gives you 1 wood. I want it so that "_global.woodBoostSpeed" is modified by "_global.food" divided by whatever 200 is. (So that you will get resources faster for the more food you have)

    Here's the code I'm using:

    _global.woodBoostMeter =0
    _global.woodBoostSpeed = _global.food / 200
    _global.woodBoostObtainRate =1
    _global.woodBoostMeter +=_global.woodBoostSpeed
    _global.wood +=_global.woodObtainRate

    I think the problem seems to be with the "_global.woodBoostSpeed = _global.food / 200". it doesnt go up slow like it should, since "_global.food" starts out at like 200.

    Sorry if i wasn't very descriptive, lol.


    *** ALSO: ***
    Im using actionscript 2.0
    Last edited by Ffatty; 07-11-2010 at 11:32 PM. Reason: editted to put the code in quotes

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center