User Tag List

Results 1 to 7 of 7

Thread: Embedded detector in animation... problem!

  1. #1
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,540
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Embedded detector in animation... problem!

    Okay so I know the technique of using an embedded collision detector inside of an object (using a box animation and switching to it before collision checks, then switching back to the normal animation)

    The problem is that this only seems to work if you call on the object first in a condition. For example, if I do something like this:

    - Always -> Set Animation of ACTIVE to "Collision Box"
    - ACTIVE overlapping another object (do something here)
    - Always -> Set Animation of ACTIVE to "Default"

    This works just fine... It switches to the collision box animation, it checks for the overlap, then it sets back to normal animation.

    However if I do something like this:

    - Always -> Set Animation of ACTIVE to "Collision Box"
    - SOME OTHER OBJECT overlapping ACTIVE (do something here)
    - Always -> Set Animation of ACTIVE to "Default"

    It just doesn't work. How can I get this to work properly? I can't order the ACTIVE object first in the condition because that breaks the event entirely.

    What I have setup is a fastloop movement that checks if the player's collision box is overlapping the ACTIVE object and then it stops the player from moving further.

    But again if I try to do "player active object is overlapping ACTIVE" then it treats it as though the ACTIVE is on it's Default animation and doesn't consider the collision animation at all, even though it should be set to that animation when detecting the overlap. I hope this makes sense to someone.

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Thats how it works, its not something you can work around or a bug really, its how it was designed, a limitation.
    When an object is compared to as the first object in a condition, its collision mask uses the "current" mask based on its position/animation/etc in the middle of that eval loop
    When an object is compared against, as the latter object in a condition, its collision mask is based on what it was at the start of the frame, which is going to be whatever was displayed in the previous frame, making embedded detectors impossible.

    The best you can do is use dummy objects to substitute in for other objects, workarounds like distance calculations or xleft/right, or if its super necessary, use a foreach loop to check each instance individually

  3. #3
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've heard of people having success comparing both direction:
    A overlaps B + B overlaps A in order to get both masks to check, but then you're still just making sure both masks are overlapping the actual pixel data of another object.

  4. #4
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,540
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I think I tried comparing both and the result was the same as if it was comparing another object first...

    This really sucks. Seems like an inconsistency with MMF's structure. I was totally expecting the animation change to be in effect for any collision or overlap conditions, regardless of the object order.

    I guess I will have to order the collision objects before the player, but that screws up my fastloop movement/collision so now the player just gets stuck in any obstacle they touch. It's really odd that it would break a seemingly fine piece of code just because I swapped the order of the overlap objects.

    I wonder if anyone could make an example of 8 direction fastloop movement with collision checks for instanced embedded detectors? Either that or I'll have to just keep trying things.

  5. #5
    Clicker Multimedia Fusion 2SWF Export Module

    Join Date
    Sep 2006
    Posts
    1,537
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Its a tradeoff, it cuts down on some of the processing on collision detection which is fairly expensive already, but doesn't let in-the-middle-of-eval-loop collision detection work as you'd think. Its just compiling collision masks of all the objects at the start of the frame and referencing that afaik.

    I'm sure that given some ingenuity, theres always a workaround

  6. #6
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,540
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    So I solved it by literally doing something entirely different... the technique I use as a last resort collision check, though I'm not sure if the optimization will take a hit or actually improve because of it.

    Basically instead of an "on overlap" check, I compare the object's X/Y data to the player's collision X/Y data... If the player X falls inside the Object's X to Width, then that means the player is overlapping on the X. Same for the Y.

    This actually lets me define objects based on whatever I want. I define the hot spot as the top left corner of the object, and the action point as the bottom right, and I use that data to fill the square in the middle by just doing position checks. So far so good, and it will serve me well since everything in my game is box collision based. But for fine detection this would be out of the question.

  7. #7
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's pretty much how MMF's box collision works anyway, so I doubt you'll see too much a speed drop. You can do fine detection too, but you'd have to look into alternate methods (simply comparing radius for round objects, separated axis theorem, etc)

Similar Threads

  1. Embedded Font Problem
    By Taft in forum SWF/Flash Export Module Version 2.0
    Replies: 1
    Last Post: 18th February 2013, 12:25 AM
  2. Strange problem in add solid with detector
    By MEHRDAD in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 13th February 2012, 03:10 PM
  3. games embedded in e-mail?
    By JollyPanda in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 18th September 2010, 09:04 PM
  4. embedded highscores
    By life2searching in forum SWF/Flash Export Module Version 2.0
    Replies: 9
    Last Post: 14th April 2010, 11:48 PM
  5. Bad guys detector problem
    By chrilley in forum File Archive
    Replies: 5
    Last Post: 3rd December 2006, 01:52 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
  •