A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: factory game

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    26

    Unhappy factory game

    flash cs4 professional as2.0

    i want to make a factory game that transports bricks
    therefore i need a counting for a couple brick locations that change often

    first i want to start off a counting function in the first spot that keeps increasing with every second i used code: count++;
    and: setInterval(count,1000)
    so every second it adds 1 to the first spot

    first...start -- 0 -- 0 -- 0 -- finish
    after..start -- 29 -- 0 -- 0 -- finish

    next
    i want spot 2 to take bricks from spot 1

    first...start -- add1 -- 0 -- 0 -- finish
    after..start -- add1 -- add1 -- 0 -- finish
    remove1

    spot 2 removes one brick from spot 1 and adds that to its own

    ok so now after my attempt on explaining, on to my problem

    next i wanne add a max to my spots
    so if spot 2 reaches 10 bricks spot 2 wont go further
    so if spot 1 reaches 0 bricks spot 2 cant/wont go further

    now my problem is as soon as i remove any of the 10 bricks it cannot continue with the code that adds 1 every second it just stops
    the code for counting is stopped as soon it reaches the max 10 bricks it wont go further if bricks arent 10 anymore with going back to the 10 bricks

    i have been trying to search on ie to find easy codes that can count up and down, stop and continue whenever the if(maxed) is not anymore but all i can find is codes to start adding/removing or stop adding/removing no easy codes to do a couple timers at the same time and pauze them when maxed

    i hope this didnt waist your time reading it and hopefully it was a bit clear

    so anyone knows a couple easy codes to do the above
    thx in advance
    Last edited by Kascas; 08-06-2010 at 07:19 AM.

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