User Tag List

Results 1 to 5 of 5

Thread: Running a loop (Advance help needed probably)

  1. #1
    No Products Registered

    Join Date
    Jun 2010
    Location
    Sutton, Surrey, UK
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Running a loop (Advance help needed probably)

    Following on from reading this topic which I found helpful (Yes, proof I use the search tool ) http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=196407&gonew=1# UNREAD

    Now bare with me whilst I attempt to explain this, its been hard to figure out for ages. I'm also going to explain this without telling EVERY SINGLE action like "Subtract HP by damage" and stuff, since its not necessary for the solution as far as I know.

    Right, basically, I have an event that when an enemy gets hit, it sets its Flag 5 to ON and starts the fast loop "DamageEnemy".

    In the "DamageEnemy" loop, there is a few actions that involve creating active objects for a damage number, starting a loop to correctly position the actives (which is alot of events to perfect the effect i have created) then turning its flag 5 off. The flag determines if it still hasn't had numbers appear above it. The order of the actions in this loop goes like this:
    Position X "DamageMakerObject" to enemy X
    Position Y "DamageMakerObject" to enemy Y
    Create "NumberActive" at 0,0
    Create "NumberActive" at 0,0
    Create "NumberActive" at 0,0
    Start Loop "PositionNumbers"
    Flag 5 Off

    The "PositionNumbers" loop basically places the numbers in accordance to the DamageMakerObject. The reason this is needed is to align the numbers above the enemy instead of having the numbers slightly shifted to the right if its a low number (Say you hit 10, it wouldn't be DIRECTLY IN LINE above the enemy if you just positioned it above the enemy, you need to figure out how many columns are in the number)

    IN THE END, I can't get numbers to work if more than 1 enemy is hit at the same time. It creates the numbers fine and everything, but they are positioned above 1 of the enemys and not for each of them, resulting in 2 sets of numbers on top of eachother, looking like a mess.
    The enemys damage fine and everything, but the numbers struggle to position correctly.

    The point being, I was wondering if theres a way to interrupt a fastloop to go to ANOTHER fastloop then once FINISHING the 2nd fast loop, continuing the OLD fastloop.

    Sorry for the WORST explaining ever, but i'll supply screenshots if needed. I also haven't slept in ages so that might explain my stupidity. Thanks SOO much if anyone can help!!!
    Jase

  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: Running a loop (Advance help needed probably)

    Can you not simply run the fastloop once per each obejct using the ForEach object?
    Working as fast as I can on Fusion 3

  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: Running a loop (Advance help needed probably)

    The short answer is "yes." I will assume you are using an "obj is overlapping another object" to trigger the fastloop. The way I approach this is as follows:

    +Player hitbox is overlapping Enemy
    -Spread Value 0 in AltVarA(enemy) {AltVarA is any variable you use to store a unique ID in each enemy}

    +Player hitbox is overlapping Enemy
    -Start loop "IDEnemy"

    +On Loop "IDEnemy"
    +AltVarA(enemy) = LoopIndex("IDEnemy")
    +Player hitbox is overlapping Enemy
    -Start loop "DamageEnemy"

    +On Loop "DamageEnemy"
    +AltVarA(enemy) = LoopIndex("IDEnemy")
    +Player hitbox is overlapping Enemy
    -Create hit point counter

    The key here is to make sure your second loop "DamageEnemy" is using the comparison that singled this enemy out in the previous loop { AltVarA(enemy) = LoopIndex("IDEnemy") }. This will keep the same enemy selected when you run the second loop. I'd recommend actually applying damage to the enemy at this point and setting a flag so the enemy can't be damaged again. Otherwise, the overlap condition will keep damaging the enemy every frame.

    If you need any more explanation, feel free to ask. Hopefully this isn't too confusing.

    mobichan

  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: Running a loop (Advance help needed probably)

    ...or you could do the same thing with the ForEach object but save an alterable value and be more efficient.
    Working as fast as I can on Fusion 3

  5. #5
    No Products Registered

    Join Date
    Jun 2010
    Location
    Sutton, Surrey, UK
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Running a loop (Advance help needed probably)

    Wow i'm suprised anyone actually understood my explanation!
    Thanks mobichan and LB.
    I tried both ways, and both work fine, but LB's way IS more efficient. Thanks both of yers !!!

Similar Threads

  1. Running loop in background while other events occur?
    By ogrgkyle in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 29th October 2013, 04:37 PM
  2. HELP NEEDED! Rockman X [Megaman X] Dashing Help needed.
    By Rockman in forum Multimedia Fusion 2 - Technical Support
    Replies: 22
    Last Post: 30th July 2013, 07:05 AM
  3. Replies: 7
    Last Post: 25th December 2012, 11:26 AM
  4. Advance Qualifiers
    By Thuria in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 22nd November 2012, 02:53 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
  •