User Tag List

Results 1 to 4 of 4

Thread: Get only the first instance clicked

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Aug 2011
    Location
    Beverly Hills, CA USA
    Posts
    508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get only the first instance clicked

    I have 10 instances of the same object stacked on top of each other. I want an event to only be fired for the first one I click on (topmost) so I can invert it. I have tried Only one action when event loops without any luck along with my User clicks with left button on Active. Any solution?

  2. #2
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleXNA Export Module
    ProdigyX's Avatar
    Join Date
    Jan 2011
    Posts
    1,197
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    +User clicks on active
    +only one action per event loops

    this should choose only one object.

    I have use this numerous times and it has always worked for me.

  3. #3
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    lol ProdigyX he just stated he tried the only one action when event loops method.

    I think I've dealt with objects overlapping before and my solution was to run a ForEach loop through the objects, then I have a temporary variable that is set to -1. If the object's spread value is greater than the variable, then I set the variable to that object's spread value. What this essentially does is it keeps changing that temp variable until it is the highest value for that group of objects.

    After that, you can do a condition when you click on the object, you also check to see if that object's spread value is equal to the temporary value. Meaning it is the topmost object in the stack. This will ensure that you select the top most object every time.

    If anyone has a simpler way, please feel free to share.

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,393
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    The Select Object extension could do this in one line, but it's not compatible with all exporters.
    Otherwise, you can say:

    + Always
    -> Active: Set value to 0

    + Mouse is over Active
    + Player clicks
    -> Active: Spread value 1

    + Mouse is over Active
    + Player clicks
    + Value of Active = 1
    -> Active: Do whatever...

    eg. http://sdrv.ms/WC02iR

    That works because by default, the order in which objects are layered, is the same as the order in which values are spread (based on the order in which they were created). If you manually change the layering order, using "bring to front" / "send to back" etc, it won't work any more.

Similar Threads

  1. Instance inherriting from Instance
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 10th June 2013, 06:25 AM
  2. Annoying sound after button clicked
    By dylan99379 in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 27th January 2008, 03:57 PM
  3. Moving an object when clicked
    By stillhawk in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 7th July 2007, 05:44 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
  •