User Tag List

Results 1 to 7 of 7

Thread: Fastloops, Spread IDs, and RNG need help

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Dec 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Fastloops, Spread IDs, and RNG need help

    Hey everyone,

    I have been looking up Fast loops and spread IDs to give each instance of the same enemy to be unique, but they seem to act on eachother's Y position when it comes to gravity.

    I used fastloops to make it so enemies will have gravity, and have it set that every couple seconds, the enemy will jump, and when they jump, they will move towards an object, but will not move towards the object when on the ground. Whenever one instance of the enemy is placed, it works fine, but when there are multiple that are spawned in on different heights, they will constantly move towards the object unless they all are touching the ground. Any idea how I fix this? I gave an alterable value that is ID and used the Spread value function on it to make them unique, but it seems to do nothing.

    And another problem is I can't seem to find a RNG to give each enemy a random time and height they will jump at.

    All help will greatly be appreciated.

  2. #2
    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)
    Awesome that you've investigated this a little on your own already.

    The first two things you need to code are:

    Always:
    -> Spread Value "ID" in "Enemy"

    Always:
    -> Start Loop "Enemy ID" NObjects "Enemy"

    These need to be in two separate lines of code - bug in mmf2.

    Then, anytime you reference the enemy:

    OnLoop "Enemy ID"
    + LoopIndex "Enemy ID" = ID of "Enemy"

    This will give you the uniqueness you need for every instance of the enemy.

    For example:

    OnLoop "Enemy ID"
    +LoopIndex of "Enemy ID" = ID of "Enemy"
    -> Set EnemyTime to Random(7)+1
    -> Set EnemyHeight to Random (5)+1

    Anything more specific, post your mfa example

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Dec 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have

    On Loop "EnemyID"
    +"ID of "Enemy" = LoopIndex("EnemyID")

    but I don't know where to put it or what to do with it, The other part of the code that has it read when to move when the enemy is off the ground is:

    Grav of "Enemy" <> 0
    ->Start Loop "Gate Check"

    On Loop "Gate Check"
    +X position of "Enemy" < X("Gate Object")
    -> Set X position to "Enemy" X position +5

    On Loop "Gate Check"
    +X position of "Enemy" > X("Gate Object")
    -> Set X position to "Enemy" X position -5

    Where should I put the SlimeID stuff? I tried different places, but it messes up. Whenever one enemy has a different Grav than 0, They all can move in the X position, and I don't want that.

  4. #4
    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)
    Not sure from your code exactly what you're trying to do, but here's a quick example. Note that the same code is used every time I want to reference the individual enemies.
    Attached files Attached files

  5. #5
    Clicker Multimedia Fusion 2

    Join Date
    Dec 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here is what I mean. I put the OnLoop and Loopindex code whenever I reference the Slime, but nothing happens. If you take that out, it will work, but the slime will move whenever at least one is in the air, which shouldnt happen. If there is only 1 slime, it works fine, but when there are multiple, then they do this. If all the slime are spawned on the same height, then it will work fine, but if at least one is in the air, they all will be able to move towards their desitnation, which presents a problem, because I will have multiple spawning in at different times and different heights, inevitably making them able to move freely as others spawn in. Where did I go wrong?
    Attached files Attached files

  6. #6
    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)
    Still not sure what you're trying to do with "GateCheck" but here are a couple of problems I see.

    Lines 1 and 5 have the same code.

    You can't put 2 On Loops in the same line. (That's why only 1 is red).

    If you have a "during loop 1, start loop 2" you can toggle an alterable value or use a flag to identify which active you're addressing.


    For example:

    Always:
    ->Spread Value 0 in ID of Enemy

    Always:
    -> Start "Loop1" NObjects Enemy

    On Loop "Loop1"
    + ID of Enemy = LoopIndex of "Loop 1"
    -> Set Flag 1 of Enemy on
    -> Start "Loop2" 13 Times
    -> Set Flag 1 of Enemy off

    On "Loop2"
    + Flag 1 of enemy is on
    -> Set XPos of Enemy +1


    Hope my example helps. Again, I'm not sure what you're trying to do with your red Active object.
    Attached files Attached files

  7. #7
    Clicker Multimedia Fusion 2

    Join Date
    Dec 2014
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually what you did solved my problem perfectly. The Red active object was just suppose to be the destination the Enemies were trying to reach, "GateCheck" was just the name I gave it for my project, I forgot to change it to something more understandable for this purpose like "Destination". Thank you for your help!

Similar Threads

  1. XNA and FastLoops
    By King_Cool in forum XNA Export Module Version 2.0
    Replies: 6
    Last Post: 26th January 2012, 08:08 AM
  2. How are spread values spread ?
    By rudy in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 6th December 2011, 08:15 PM
  3. Fastloops
    By Solgryn in forum Android Export Module Version 2.0
    Replies: 1
    Last Post: 4th August 2011, 07:28 PM
  4. Stopwatch and Fastloops
    By Tiles in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 26th January 2008, 04:54 PM
  5. Fastloops
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 21st June 2007, 09:22 PM

Tags for this Thread

Posting Permissions

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