User Tag List

Results 1 to 6 of 6

Thread: Problem with testing collisions using qualifiers

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SpaceKoala's Avatar
    Join Date
    Jan 2019
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with testing collisions using qualifiers

    Hi All,

    Maybe you can help me with this problem I have always had with clickfusion. In my game that teaches Japanese you have to drag a Japanese letter over it's English counterpart. To save time I have used qualifiers so that I do not need to make a collision test for each letter but I have found when I run my game it only detects the first object I have created but ignores the rest. Here's a video demonstrating this:



    The letters should snap into place but they only do this for the first object I created the other's just sit where they were dropped.

    Also my win condition which is that each Japanese letter tile is colliding with it's English counterpart does not trigger (I'm only testing it with the first 5 but even that many does not trigger).

    Clipboard01.jpg

    I know I need to use fastloops somehow but even using them how the tutorials suggest doesn't seem to work.

    Clipboard02.jpg

    (targets = Japanese letters, doors = english letters)

    Is there anyway you can suggest that would be a better way to handle these kind of events?

  2. #2
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export Module
    Janette5's Avatar
    Join Date
    Dec 2014
    Location
    Western Cape, SA
    Posts
    898
    Mentioned
    121 Post(s)
    Tagged
    0 Thread(s)
    You could solve this by using placeholders - which I get the impression you're already using. Place an object over each letter in the right spot. Don't make it visible - so the player doesn't see it.

    Give each placeholder an alterable value based on the letter they represent.

    When a player clicks on the placeholder, it tests if the value is correct, if it is, it replaces the placeholder with the held object. You can do all of this with qualifiers.

    For this you don't need any loops and the objects will always be placed on the right spot.

    However, if you want to keep what you have then you need to replace your general loops with "for each" loops. You will tell Fusion to check each object, not just run it 50 times.

    Let me know if you need an example.

  3. #3
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,417
    Mentioned
    116 Post(s)
    Tagged
    0 Thread(s)
    You need to use a forEach loop and not a fastloop.

    When you do this:





    ...Fusion runs 50 loops like this:

    #1
    -Does any target overlap a door?
    ---yes? Does it also have a Y position like .....and X position like.....?
    --------Yes? Great! Position the target at the door!

    #2
    -Does any target overlap a door?
    ---yes? Does it also have a Y position like .....and X position like.....?
    --------Yes? Great! Position the target at the door!

    #3
    -Does any target overlap a door?
    ---yes? Does it also have a Y position like .....and X position like.....?
    --------Yes? Great! Position the target at the door!


    The loop gets run 50 times, but each loop is the same. It asks "does any target overlap a door"? every time. And to answer this question, it always tests through all targets in the same order: the order you created them in. So, it asks the same exact question 50 times, and gets the same exact answer 50 times, and each answer relates only to the first target it finds, which is the first one you created.







    So what you need to do is use a forEach loop instead. This way, you'll be making Fusion run the loop once for every single instance of the target, explictly. In effect, you'll be making Fusion do this:

    -for each target that currently exists, run this forEach loop:

    #1
    -Does this target overlap a door?
    ---yes? Does it also have a Y position like .....and X position like.....?
    --------Yes? Great! Position the target at the door!

    #2
    -What about this target? Does this target overlap a door?
    ---yes? Does it also have a Y position like .....and X position like.....?
    --------Yes? Great! Position the target at the door!

    #3
    -What about this target? Does this target overlap a door?
    ---yes? Does it also have a Y position like .....and X position like.....?
    --------Yes? Great! Position the target at the door!



    Does this make sense?


    If you haven't used them before, forEach loops can be a bit hard to find. For the action that calls them. you need to find it from the object itself, like this:



    For the condition where you do the actual loop, you find it also from the object itself, like this:



    The resulting events look like something like this

    :

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    SpaceKoala's Avatar
    Join Date
    Jan 2019
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help. I've followed your instructions and got it to work.

    I did not know about the "for each" function so that's a huge game changer for me.

  5. #5
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,417
    Mentioned
    116 Post(s)
    Tagged
    0 Thread(s)
    Great! I didn't use forEach loops much for my first few years, but I use them all the time now. They make life a lot easier.

  6. #6
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCiOS Export ModuleSWF Export ModuleFirefly 3D Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    fnkycoldmadeanr's Avatar
    Join Date
    Jul 2017
    Location
    Melbourne, Australia
    Posts
    175
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Clickteam should hire you to do their documentation @Volnaiskra
    It would take me days to type all that up.

Similar Threads

  1. Scoping qualifiers and collisions
    By marbenx in forum Fusion 2.5
    Replies: 3
    Last Post: 24th June 2019, 12:07 PM
  2. Replies: 3
    Last Post: 12th May 2017, 05:00 PM
  3. Replies: 0
    Last Post: 27th March 2014, 09:30 AM
  4. Qualifiers and Fast Loops Problem.
    By BREK in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 23rd November 2008, 10:37 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
  •