User Tag List

Results 1 to 4 of 4

Thread: Count up / Count down

  1. #1
    No Products Registered

    Join Date
    Aug 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Count up / Count down

    I have a counter that has a minimum value of 0 and a max value of 100.

    What I want to do is:
    Press "space" start counting up to 100
    When it hits 100 count down to zero
    When it hits 0 count back up to 100

    Now I have 2 event groups one for counting up and one for counting down and I turn off and on the event groups depending on if I need to count up or down.

    This is working fine but I wonder if there is an easier way to do this that I don't know <img src="/center/images/graemlins/smile.gif" alt="" />

    thx,
    Sam

  2. #2
    No Products Registered

    Join Date
    Aug 2006
    Location
    Spryfield, Nova Scotia, Canada
    Posts
    85
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Count up / Count down

    You may not even need two seperate program groups for this: first you'd have a counter object with a minimum value of 0 and a maximum of 100. Then, a line which reads

    Upon pressing space bar
    +Every [time increment]
    *Add 1 to counter.

    When counter= &lt;100
    +Every [time increment]
    *subtract 1 from counter

    When counter =&gt;0
    +Every [time increment]
    *add 1 to counter

    That should give you a start. And remember, sometimes you indeed want the best solution, not just a quickie fix. Sometimes the extra effort will pay off in the long run.

  3. #3
    No Products Registered

    Join Date
    Aug 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Count up / Count down

    I don't think your solution even works or maybe I didn't explain what I wanted the counter to do.

    Once I press space the counter counts up and down by itself.

    You only press space once and then after that it counts up to 100 then down to 0 then back up to 100 and on and on.

  4. #4
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Count up / Count down

    Those events won't work correctly on their own, as the counter would go in both directions simultaneously when between 0 and 100.

    You would need to add an object that can store whether the direction is currently going up or down - anything will do for this, be it an active's flag, alterable value, or another counter. When this value is in the 'off' state, nothing should happen, but the space bar should allow it to move to the 'counting up' state. When it hits 100, the flag value should be changed, making the counter count down. Even though it has three states, I'm going to call it 'flag':

    Upon pressing space bar
    + Flag is 0
    &gt; Set flag to 1.

    If flag is 1
    + Restrict actions for blah
    &gt; Add 1 to counter

    If counter is 100
    + Flag is 1
    &gt; Set flag to 2

    If flag is 2
    + Restrict actions for blah
    &gt; Subtract 1 from counter

    Counter is 0
    + Flag is 2
    &gt; Set flag to 1

    Flag is 1 or 2
    + Space is pressed
    &gt; Set flag back to 0 to stop it.

Similar Threads

  1. Count
    By Panchos in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 27th December 2012, 06:56 PM
  2. Star Count
    By Jeff in forum iOS Released Games & Apps
    Replies: 0
    Last Post: 4th August 2011, 02:24 PM
  3. Newgrounds count vs. mochi count
    By Tuna in forum SWF/Flash Export Module Version 2.0
    Replies: 9
    Last Post: 20th September 2010, 08:37 PM
  4. looking for way to count objects
    By piki in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 25th June 2008, 02:28 AM
  5. Object count bug
    By Nifflas in forum File Archive
    Replies: 2
    Last Post: 1st December 2007, 08:25 AM

Posting Permissions

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