A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: simple timer v2

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

    simple timer v2

    Hey, im making a simple factory game

    a factory will produce 1 material every second
    to build one you need 5 materials
    a big factory will produce the same but has other benefits
    to build one you need 5 factory's

    here is my button to make a factory

    on(press)
    if(materials >= 5)
    {
    _root.materials = _root.materials -5
    _root.factory = _root.factory +1
    {
    timer1 = function()
    {material++}
    }
    setintervalblabla
    }

    now after i builded 5 factorys i want another button wich can turn
    5 factory's into a big factory

    here is that button

    on(press)
    if(factory >= 5)
    {
    _root.factory = _root.factory -5
    _root.bigfactory = _root.bigfactory +1
    {
    timer2 = function()
    {material++}
    }
    setintervalblabla
    }

    this all works i now lost my factory's and got 1 big factory
    but...my material output is now 6 every second instead of 1...

    so what i tried is clearInterval(timer1Interval)
    wich worked i now got only 1 output
    now i made some more factory's....but as soon my first factory was up
    instead of getting 2 output i got 6-7 output again

    the cleared factory's are back to annoy me again.....how do i beat them?

    maybe there is something like clearFunction?
    or any better/easyer ways to make this kind of a factory game?
    or...

    thx in advance

  2. #2
    Prid - Outing Nig 13's Avatar
    Join Date
    Jul 2006
    Location
    Norway
    Posts
    1,864
    please provide FLA
    I am back, guys ... and finally 18 :P

    BRING BACK THE OLD DESIGN!! OR AT LEAST FIX THE AS TAGS

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