User Tag List

Results 1 to 10 of 10

Thread: Adding alterable values of multiple objects

  1. #1
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding alterable values of multiple objects

    In my game I have a number of identical objects which I am creating using "create object" at the start of the frame. Various events in the game set the "alterable value A" of an object.

    What I want to do is add up the "Alterable value A" for each of the objects I have created. e.g:

    Object 1 has alterable value A = 0
    Object 2 has alterable value A = 1
    Object 3 has alterable value A = 3
    Object 4 has alterable value A = 5

    How can I get the total (9 in this example) so I can then trigger an event when a particular total is reached.

    In pseudo-code, I would do something like:

    For each object
    Add Alterable Value A to Counter
    End for

    I have no idea how to do this in MMF2!

    Thanks in advance

  2. #2
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    It's the same exact thing as in your pseudo-code! Just use the ForEach obejct
    Working as fast as I can on Fusion 3

  3. #3
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    It's the same exact thing as in your pseudo-code! Just use the ForEach object
    I don't know what a "ForEach" object is in MMF; I can't find any reference to it. Can you give me a clue?

    Thanks

  4. #4
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    No, not a ForEach object; The ForEach object. It's an extension.
    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=191428#Post1914 28
    Working as fast as I can on Fusion 3

  5. #5
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    No, not a ForEach object; The ForEach object. It's an extension.
    Ah, I see! I am working with the SWF exporter and this extension does not appear to have been converted.

    Any other ideas as to how this can be achieved?

    Thanks.

  6. #6
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    Roughly this:
    Always:
    -Set counter to 0
    -Spread value 0 in alterable value U of Object
    Always:
    -Start loop "total" for number of "Object" loops
    On loop "total":
    +Compare to alterable value U of Object equals loopindex("total")
    -Add alterable value A("Object") to counter
    Compare to Counter greater than 10:
    -Win game

    Start loop and spread need to be in separate event lines.

  7. #7
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    Thanks Dynasoft; I was having a look at spread values and fast loops (which I have not used before) as they were mentioned in a post relating to the ForEach object (which sounds great, but alas, not 'SWFed' yet) and was struggling to get my head round it.

    I'll have a go based on your step-by-step advice; The info I found on Spread Values in the MMF Help file is somewhat limited!

    Thanks.

  8. #8
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Posts
    6,773
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    It's pretty simple - if you spread the value 0 in Alterable Value A for an object, each instance of the object gets a unique number, beginning at 0. So if you have three instances of your object, they'll get 0, 1 and 2 in that alterable value.

    That means you can then start a fastloop, and use the number to select the object (by choosing an object which has the same value as the fastloop index).

  9. #9
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    Keep in mind the last object created is the first one that is made, so when a new one is created the spread values all shift over.
    Working as fast as I can on Fusion 3

  10. #10
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Adding alterable values of multiple objects

    Thanks all,

    I have now got the hang of both Spreading and Fast Loops; neither of which I have needed until now!

    As ever, finding new tools is usually necessitated by new requirements!

    I really appreciate your help.

Similar Threads

  1. [Request] Active Objects: Reset Alterable Values
    By Dines in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th January 2008, 08:06 AM
  2. Alterable values in ALL objects
    By waffles in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 23rd August 2006, 06:42 PM

Posting Permissions

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