User Tag List

Results 1 to 4 of 4

Thread: Copying variables from one object to other

  1. #1
    No Products Registered

    Join Date
    Feb 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Copying variables from one object to other

    Hi, I came here to ask about something that's practically stopping the development of my fangame.

    The problem is this: I have two objects, one called "Boom" and the other called "Bam". "Boom" has all of its variables(from A to Z) defined with values. "Bam" does not. BUT, if I want to copy all the "Boom"'s variables in "Bam" when both collide with each other, how do I do it?

    Other problem I encountered is the next one: I have a Health Bar in turn-based battle, I want that health bar to switch between the both playable character's health in their respective turns. How do I do that?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module

    Join Date
    Jul 2006
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know if there is an easier way, but you can always do this:

    On collision
    --> set Alt A (Bam) to Alt A (Boom)
    --> set Alt B (Bam) to Alt B (Boom)

    and so on

  3. #3
    Clickteam Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export 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)
    Simon's Avatar
    Join Date
    Jun 2006
    Location
    UK
    Posts
    2,735
    Mentioned
    65 Post(s)
    Tagged
    3 Thread(s)
    Hi! You could achieve this with a fastloop and referencing the variables by index and not by name...

    If you go to set a variable of an active, for example, you'll notice that next to the name there is a button with "Use Expression" in it. Using this you can set a value by it's index, so "Alterable Value A" is index 0, "...B" is 1, and so on. Similarly, when selecting variables from an object you can use the "Alterable Value By Index" function to retrieve them.

    A fastloop would look like this:

    Code:
    start loop "copy" 26 times
    
    on loop "copy", set value by index [loopindex("copy")] in object a to value by index [loopindex("copy")] in object b

    What you have to remember to do is select the objects each time in the fastloop because the objects which collided will only be selected in the event which calls the fastloop. To do this, you might say on collision of bam and boom, store bam's fixed number in global value a, and boom's fixed number in global value b. Then, in the fast loop you can add the conditions: select by fixed number (bam) using global value a, and then the same but with global value b for boom.

  4. #4
    Clicker Multimedia Fusion 2Android Export Module
    Corlen's Avatar
    Join Date
    Mar 2007
    Location
    Your House
    Posts
    848
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simon's solution would work wonders and save you a lot of time.

Similar Threads

  1. Text Object with variables?
    By algiz in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 22nd November 2010, 06:36 PM
  2. Named Variables Object
    By MechatheSlag in forum Extension Development
    Replies: 0
    Last Post: 31st August 2008, 09:49 AM
  3. Pass variables to Created object
    By krestalex1 in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 16th May 2008, 09:13 PM
  4. [Suggestion] Object folder structure when copying.
    By RaiFox in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 21st March 2007, 07:25 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
  •