User Tag List

Results 1 to 9 of 9

Thread: Another collision issue with multiple instances

  1. #1
    Clicker Fusion 2.5 DeveloperiOS Export ModuleMac Export Module
    Enchantainment's Avatar
    Join Date
    Sep 2012
    Location
    West Yorkshire
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Another collision issue with multiple instances

    Some of the main issues I always seem to run into with Fusion, is having multiple instances of an object.

    Basically I'm trying to make an object stop when it hits the ground, or a platform. I could use "is overlapping a backdrop", but then I'll have the issue of the object not stopping, until it's actually overlapping, which means it'll sometimes appear "in the ground". To get around this, I decided to create an event that detects when the object is a pixel or 2 above the platform/ground, then stop. It works great, but only on the latest instance of the platform. It either completely ignores all other instances that are below it, or it'll stop at a weird place, nowhere near them.

    Here's a screenshot of my event that works perfectly on the last instance placed in the frame. If anyone could give me any suggestion about why this might happen, or how to fix it, I'd very much appreciate any advice. Also I tried using "For Each Loop" and it didn't help. Thanks!

    Event.png

  2. #2
    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)
    The main problem is that you are using the built-in movements. They don't guarantee a collision check for every pixel moved, so your objects are not detecting the overlap at the right time every time an overlap occurs. You should look at DavidN's fastloop tutorial to see how to approach moving objects in fastloops.

    But based on your code, you could just add an "Is overlapping (object name)" as a condition to your event line. Then add an additional action that repositions your character sprite to the proper Y position above the platform. The only downside here is if you happen to overlap multiple copies of the platform at the same time, MMF will only detect the last platform object created. So you would want to use a ForEach loop to figure out which platform you are touching.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Seems like a task for the always-foreach pair

    You should probably "foreach" your platforms,
    and possibly your colliding objects if more than one...

    also, there's some solution to this:

    I could use "is overlapping a backdrop", but then I'll have the issue of the object not stopping, until it's actually overlapping
    a "pushout" loop would work fine,
    like:

    object overlapping platform
    >>> start loop "pushout"

    on loop "pushout"
    >>> set object position to Y-1

    on loop "pushout"
    +object overlapping platform
    >>> start loop "pushout"

  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)
    Schrodinger: I think for your last event line you meant:

    +On Loop "pushout"
    + Object overlapping platform (NEGATE)
    -- Stop Loop "pushout"

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    I got what you mean,
    but this would result in the object being pushed out "visibly" one pixel per frame
    (if overlapping more than one pixel)

    while I meant "restarting" the loop, on loop ,
    while object still overlaps, and making it move just one pixel at time
    would (*should*) result in the object stopping exactly above the platform without any visible displacement
    because all would happen in the same frame

    like this:
    pushout_loop.mfa

  6. #6
    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)
    Ah, I assumed your ran the initial loop -1 (infinite) times.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    oh sorry, I didn't specify, all loops were performed 1 times

    just a matter of habit,
    that would give the same result I guess

  8. #8
    Clicker Fusion 2.5 DeveloperiOS Export ModuleMac Export Module
    Enchantainment's Avatar
    Join Date
    Sep 2012
    Location
    West Yorkshire
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks for the suggestions. I'll get testing them out to see if I can get it working

  9. #9
    Clicker Fusion 2.5 DeveloperiOS Export ModuleMac Export Module
    Enchantainment's Avatar
    Join Date
    Sep 2012
    Location
    West Yorkshire
    Posts
    140
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by schrodinger View Post
    Seems like a task for the always-foreach pair

    You should probably "foreach" your platforms,
    and possibly your colliding objects if more than one...

    also, there's some solution to this:



    a "pushout" loop would work fine,
    like:

    object overlapping platform
    >>> start loop "pushout"

    on loop "pushout"
    >>> set object position to Y-1

    on loop "pushout"
    +object overlapping platform
    >>> start loop "pushout"
    This works PERFECTLY. I can't believe I was so close to figuring it out, yet so far. I actually first tried it with a fastloop, but the part I missed out was the second "On loop "pushout" + overlapping platform".

    Anyway it's working now so that's all that matters. Thanks very much for the help!

Similar Threads

  1. Collision between two instances of a same object
    By DavidT in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 16th July 2014, 12:58 AM
  2. Collision between different instances of the same object
    By DavidT in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 14th May 2014, 02:20 AM
  3. An issue with the direction of after-images for multiple instances of the same object
    By Jocastus in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 18th December 2013, 04:04 PM
  4. Coding Collision detection for Multiple Instances with fastloops
    By alxmrg in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 12th February 2012, 09:33 PM
  5. multiple instances spawning at multiple places
    By CPW in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 22nd February 2009, 12:38 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
  •