User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 12

Thread: So, fastloops for multiples of same object?

  1. #1
    Clicker Multimedia Fusion 2SWF Export Module
    Tsun's Avatar
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    So, fastloops for multiples of same object?

    I think someone explained this already with ForEach object, but I couldn't quite get it to work or then I didn't understand.

    Let's say I use fastloop for the physics of a box, how do I make it work once there is 2 or more of the boxes in the field?

    There's starting to be a lot of things that I can't make any progress with until I manage this. ´o´

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

    Re: So, fastloops for multiples of same object?

    Run a ForEach loop on the boxes, and for each object turn a flag on, run the fastloop for the flagged object, then turn the flag back off. This workaround is slower than if ForEach could start a fastloop for a specific object or group of objects, but for some reason ForEach does not have this much needed feature.
    Working as fast as I can on Fusion 3

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module
    Tsun's Avatar
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: So, fastloops for multiples of same object?

    I'm sorry I don't think I still understand. ;; Was I supposed to use a normal fastloop somewhere? Because when I start a foreach loop, it doesn't ask how many times I want to repeat it, and that is exactly the thing that I require from a fastloop.

    I need the loop to be repeated times relative to the box's own speed(alterable value).

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

    Re: So, fastloops for multiples of same object?

    Quote Originally Posted by Tsun
    Was I supposed to use a normal fastloop somewhere?
    Quote Originally Posted by LB
    Run a ForEach loop on the boxes, and for each object turn a flag on, run the fastloop for the flagged object, then turn the flag back off.
    Answer: Yes

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module
    Tsun's Avatar
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: So, fastloops for multiples of same object?

    Agh I still can't figure it out. ^^;
    I'm not sure if I still understood wrong, or if it just isn't possible to do the way I want.

    This is a very simplified version of gravity for the player, which I am trying to translate to a box, but it works only if there's 1 of the object:

    All the boxes in the air have their falling speed (loop's iteration count) set to 0 if another box is created.

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

    Re: So, fastloops for multiples of same object?

    Start a ForEach loop for each object, and the actions would be:
    Turn Flag 0 On
    Start Fastloop "V"
    Turn Flag 0 Off [size:8pt](note: affects all instances but has the desired result)[/size]

    Then on your loop just add a condition to check that the flag is on before any other conditions.
    Working as fast as I can on Fusion 3

  7. #7
    Clicker Multimedia Fusion 2SWF Export Module
    Tsun's Avatar
    Join Date
    Jun 2011
    Location
    Finland
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: So, fastloops for multiples of same object?

    Ohhh so I did misunderstand afterall.

    It gets laggy pretty quick but at least it works! Thank you so much!

  8. #8
    Clicker Fusion 2.5 DeveloperiOS Export Module
    Gamengo's Avatar
    Join Date
    Sep 2013
    Location
    Paris, France
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there,
    I have the exact same problem here, don't know why Fusion 2.5 doesn't allow a numerous For Each
    I followed all the steps but it still doesn't work, I think I miss something with my bad english.
    Do you have any example file please ? It would be so great...

  9. #9
    Clicker Fusion 2.5Android Export ModuleSWF Export Module
    Ziplock's Avatar
    Join Date
    Oct 2013
    Posts
    448
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This comes up a lot. Not sure about 2.5, but you shouldn't need multiple instances of the ForEach object - 1 can apply to as many different objects as you want.

    The ForEach object is a quick workaround for a couple of easy fastloops that you might wanna learn to implement, especially if the ForEach object isn't compatible with 2.5:

    Make an active object and give it a variable called "ID." Leave the value at 0.

    Always:
    -->Spread Value-->Active-->ID = 0

    Always:
    -->Start Loop-->"ActiveID" = NObjects( "Active" )

    On loop "ActiveID"
    +ID of Active = LoopIndex("ActiveID"):
    -->Active-->Set internal flag 1 on
    -->Start Loop-->"ActiveMove" 1 time
    -->Active-->Set internal flag 1 off

    On loop "ActiveMove"
    +Internal flag 1 of Active is on:
    -->Set x("Active") to x("Active")+1


    This is a very basic technique of making multiple instances of the same active object work independently. The "ActiveID" loop is constantly running as many times as you have objects. The "ID" variable of the object is constantly spreading so each instance of the object has a different value. When the value of the "ActiveID" loop matches the "ID" value of the object (which are all unique), it activates that singular object with a flag and starts another loop called "ActiveMove." When the "ActiveMove" loop is done, the flag shuts off and it moves onto the next object.

    Everything else is done in this secondary "ActiveMove" loop. As long as you say "On loop 'ActiveMove'" and "Internal flag 1 of active is on," you've got your unique movement.

    This way, objects can be duplicated and it will work no matter how many you have.

    Here's a quick example:
    Attached files Attached files

  10. #10
    Clicker Fusion 2.5 DeveloperiOS Export Module
    Gamengo's Avatar
    Join Date
    Sep 2013
    Location
    Paris, France
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much for your file, I add an acceleration in the loop with an object alterable value and it works fine (as you can see in enclosed file).

    Maybe one last question if someone can answer it too: in my file, you can reverse gravity using right or left click button (the code should be more clean but I did it very quickly, it's just for the example). It works with the ground, all objects fall in the right place, but the top objects over other objects are always in the wrong place (inside another).

    I tried a lot of things but I'm still in a dead end

    multiple_instance_bis.mfa

Page 1 of 2 1 2 LastLast

Similar Threads

  1. [Possible Bug] FastLoops with a side of Object Ordering
    By ProdigyX in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 25th June 2012, 12:50 PM
  2. Why does "Create Object" make multiples instead of one item
    By rubes in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 5th May 2012, 11:01 PM
  3. Object detection, multiple duplicates /w fastloops
    By Popcorn in forum File Archive
    Replies: 0
    Last Post: 27th April 2009, 08:13 PM
  4. [Bug?] Edit Object in Fastloops
    By Dines in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 3rd June 2007, 06:38 PM
  5. FastLoops with .ini object
    By MelliGeorgiou in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 3rd August 2006, 04:13 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
  •