User Tag List

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

Thread: ForEach issue

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    ForEach issue

    I seem to be having a problem with the ForEach object. I have a ForEach loop that compares fixed values of a qualifier and also compares an alt var for health and an alt var for enemy type. It is something like this:

    +EnemyHealth = 0
    --Start ForEach loop "DestroyEnemy"

    +On ForEach loop "DestroyEnemy"
    +Fixed(qualifier) = Fixed ForEach "DestroyEnemy"
    +Health(qualifier) = 0
    +EnemyType(qualifier) = 1
    --Add 1 to counter
    --Destroy(qualifier)

    +On ForEach loop "DestroyEnemy"
    +Fixed(qualifier) = Fixed ForEach "DestroyEnemy"
    +Health(qualifier) = 0
    --Start loop "DeathFx"
    --Destroy(qualifier)

    In this scenario, I expect that when I kill an enemy of type 1, they will be destroyed and no death fx loop will be run. But I find that the fx are being created anyway.

    Is this a bug? If it isn't is there a workaround?

    Mobichan

  2. #2
    Clicker Multimedia Fusion 2 Developer

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

    Re: ForEach issue

    You shouldn't need to test fixed values, you should just be able to ForEach on the qualifier and it should work.

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Re: ForEach issue

    I am using the fixed value comparison, since I sometimes need to run a sub fastloop and return to the ForEach loop. I've never actually been able to make ForEach loops work without the fixed value comparison.

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Re: ForEach issue

    I have uploaded a simple example of what I am having trouble with. I used to use nested fastloops, but converted my code to use ForEach loops. Now I am having this issue.

    File is here:
    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=209756&#Post209 756

  5. #5
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Re: ForEach issue

    Sorry to bump this, but can anyone at least explain what is happening here? I can't figure out why an object that is destroyed in one event line is still able to be recognized by a subsequent event.

  6. #6
    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: ForEach issue

    I wonder if objects are only actually destroyed at the end of a fastloop - try setting a value on the objects along with destroying them, and test for that within the loop (that is, + HasBeenDestroyed("Enemy") == 0)

  7. #7
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Re: ForEach issue

    I didn't have any issues using a normal, nested fastloop setup. I only noticed this with the ForEach loop.

    DavidN: I tried your suggestion and it would seem that having another var to check against stops the problem (confirming your suspicion). But if you need to waste a variable to make this work, that seems to be a big negative to using ForEach over nested fastloops.

    Can Ross confirm any of this?

  8. #8
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: ForEach issue

    don't objects continue to exist for the entire frame after they are 'destroyed', not just a fast loop? IE, calling "destroy" on an object doesn't actually do a thing to the object until the end of the code. Any code further down the line will continue to reference them, won't it? Thats not unique to fast loops or foreach

  9. #9
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export ModuleUnicode Add-on
    Looki's Avatar
    Join Date
    Aug 2006
    Location
    Karlsruhe, Germany
    Posts
    3,741
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: ForEach issue

    Pixelthief, that's correct.
    From what I remember, when you destroy an object, an internal flag is set to true, and at the end of a game frame, all objects with that flag will be removed.

  10. #10
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,544
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Re: ForEach issue

    yeah those are two things MMF3 better be able to do- instantly remove objects, and create objects dynamically runtime according to parameters. From what i understand theres no way extensions could do either of those

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Counter updating issue or code issue?
    By KLiK-iT in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 14th March 2013, 01:48 PM
  2. Foreach
    By AndyH in forum iOS Export Module Version 2.0
    Replies: 10
    Last Post: 31st January 2012, 06:47 AM
  3. ForEach in swf
    By MJK in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 18th July 2010, 07:27 AM
  4. How do i do a ForEach
    By Spryz in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 12th May 2008, 12:45 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
  •