User Tag List

Results 1 to 6 of 6

Thread: Can't detect collision when have 2 or more equal objects.

  1. #1
    No Products Registered

    Join Date
    May 2015
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't detect collision when have 2 or more equal objects.

    Hi all, i introduce myself, I'm Padella and I'm new in the forum and almost new in mmf.
    I apologize for my english since i dont speak it very well.

    Here is my problem:
    I've put in the frame some arrows and i want the "hero" to move in direction the arrow he collides point to. I want him to start the movement when he collides the exact center of the arrow, so i've put in the condition the x and y values control.
    It works well if there's only one arrow in the frame. If i have one arrow, for example, pointing to right he collides with it and change his direction, but if i spawn 2 or more arrows in the same direction(the same object) it doesnt work.

    Do you know where is the problem?

  2. #2
    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)
    Welcome to the forum

    From your description of the problem, you probably have to "scope" your coordinate checks on the arrows.
    In short: Fusion can handle multiple "instances" of the same (duplicated) objects,
    but when you place actions in the event editor, if you don't take adequate "measures",
    you will end up affecting all of those duplicated objects (if applicable) or the last one added.

    So, it is likely that when you check hero position against the arrow position,
    you are actually checking his position from the "last" added arrow, because Fusion doesn't know which arrow to pick, if you don't specify that.

    To specify that, you have many ways.
    One could be putting in the same condition:

    hero collides with arrow
    +arrow x,y pos = hero x,y pos

    If this is not the issue, please consider uploading the .mfa you're working on,
    so we may better check.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    1,159
    Mentioned
    199 Post(s)
    Tagged
    0 Thread(s)
    What you can also try is if your arrows aren't moving, but your hero is, make sure you type the collision

    Collision between "ARROW" and "HERO" (static object first and moveable object second)

    and NOT collision between "HERO" and "Arrow" because that makes a difference in Fusion.

  4. #4
    No Products Registered

    Join Date
    May 2015
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi thank you for replying

    I tried your solution but it doesnt seem to work. Maybe i did something wrong. I upload the .mfa.

    So, when i put more controls in the same condition, there's difference from the control with the dot and the one with the plus? i thougth they were in AND like: if(control1 && control2).

    if i put:
    hero collides with arrow
    +arrow x pos = hero x pos
    +arrow y pos = hero y pos

    it doesnt work. If i put the x control as first, it works on both arrows but only if they have same x position.

    To test the file: click on the arrow on the right you want to dispose in the squares then click the square you want to position the arrow. then click space to let the active move.

    EDIT: Hi Janette, i didnt read your answer before, sorry. I've tried putting the static object first too, but didnt worked as well
    Attached files Attached files

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    1,159
    Mentioned
    199 Post(s)
    Tagged
    0 Thread(s)
    Hi Padella

    There are smarter and more experienced people than me on these forums - so they might be able to give you a better solution.

    Your action point for your arrows were set at 0, 0 and not in the middle of them.
    I changed the code from checking the co-ordinates to just moving your hero onto the arrow - this is slightly jerky but it works. Hopefully someone can tell you if there is a way to do it smoother.

    Edit: If you turn off "Use Fine Detection" for your hero and arrows, and put the action points for your arrow back to 0,0, then this is actually smooth.

  6. #6
    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)
    Hello again,

    I've also cleaned up a little your code, this seems working OK now:
    Donald_1.mfa

    Main issue, imo, was due to collision checking and coordinate checking not timing together well,
    because collision is an "instant action", so it's checked once upon happening,
    while "overlapping" (the one i substituted in your code) is checked as long as the two objects overlaps,
    so that when their X-Y positions will also match, the actions would be triggered.

    Cool project, by the way!
    I like puzzle games with cute graphics

Similar Threads

  1. Replies: 16
    Last Post: 16th July 2014, 08:59 AM
  2. detect a collision don't work
    By arthurh in forum iOS Export Module 2.5
    Replies: 1
    Last Post: 20th April 2014, 08:35 AM
  3. Collision detect object and backdrop
    By ASD in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 14th December 2010, 10:20 AM
  4. Collision detect Y instance
    By willy in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 15th October 2008, 05:39 PM

Posting Permissions

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