User Tag List

Results 1 to 4 of 4

Thread: Please help with understanding object scoping in child events

  1. #1
    Clicker Multimedia Fusion 2
    LobsterKing's Avatar
    Join Date
    Dec 2012
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Please help with understanding object scoping in child events

    Hiya, I've been trying out 2.5+, especially using child events.

    It worked pretty well so far, until I ran into this curious case. Here's a sample mfa for you to try out that reproduces the case I've had on my project.

    nested_test.mfa

    We have characters separated in three objects : the "Character" (red) itself that moves on the screen, the "Character Values" (blue) which is hidden contain all sorts of constant values specific to that character, and the "Character Input" (green) which is just an interface between keyboard presses and the actions the character should do.
    For a given character, these 3 objects are linked together according to the ID given in the first alterable value. Then depending on which key you're pressing, either character will move left or right.

    The following code works properly :

    WithoutNested_.png

    Note that the deceleration code at lines 28 and 29 share the two same first conditions, so we might as well merge these events and add another nesting layer, which become lines 18-19-20 here:

    WithNested_.png

    But, turns out this doesn't work. If you try the sample game and press G to use the nested lines, you'll notice something is going wrong with that event. It seems like the other character is causing the deceleration to take place despite defining the object scope in line 15.

    To investigate more, I added some debug actions to confirm which IDs were being used in the deceleration event (see second frame of example mfa) :

    WithNested.png

    But now, everything works! Events are still nested in the same way, the only new things are the debug actions, but now both characters seem to move properly. Am I missing something here? Why wouldn't the second case work, and why would the third case fix it?

    Thank you and have a nice day!

  2. #2
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    12,917
    Mentioned
    94 Post(s)
    Tagged
    2 Thread(s)
    Weird. Sounds like a bug in the object selection process. I'll check the code.

  3. #3
    Clickteam Clickteam

    Join Date
    Jun 2006
    Location
    France
    Posts
    12,917
    Mentioned
    94 Post(s)
    Tagged
    2 Thread(s)
    This bug will be fixed in the build 292.11. I don't know why it was never noticed.

  4. #4
    Clicker Multimedia Fusion 2
    LobsterKing's Avatar
    Join Date
    Dec 2012
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the quick answer Yves!

Similar Threads

  1. Scoping timer events? How to do?
    By Manuel in forum Fusion 2.5
    Replies: 3
    Last Post: 23rd June 2019, 01:37 PM
  2. 2.5+ Parent & Child events: When to use it?
    By Fuuriokun in forum Fusion 2.5
    Replies: 14
    Last Post: 24th April 2019, 11:05 AM
  3. Replies: 5
    Last Post: 26th July 2017, 03:21 AM
  4. Understanding ForEach Object and Parent/Child Objects...
    By TheFieryPlumber in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 24th May 2013, 03:19 PM
  5. Understanding Events
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 21st April 2013, 03:29 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
  •