User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: How do Global Value of objects work?

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,308
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    How do Global Value of objects work?

    If you set a global value according to an active object, how does it work? Because this is how my game is set up by far.

    Global Value A - Changes Character you selected.
    Global Value Z - Changes starting position of player in the frame.

    Now, I have used the item collected code in my game where you collect an item, restart the frame, the item does not come back. It looks something like this

    Run this event once
    = Sppread Value 1 in Alterable Value A [Group.Collectables]

    [color:#FF0000]On loop "items"[/color]
    = Add 1 to Counter

    [color:#FF0000]On loop "items"[/color]
    + Global Value(value("counter")) = 1
    + Alterable Value A of [Group.Collectables] = Value("Counter")

    = Destroy [Group.Collectables]

    Apparently, when I collected one of the items I have in my game (health power up in this case), it changed my character due to the global values being the same? That's what I figure anyway.
    Though the other different items I have when collected (lets say, 1-up in this case), do not do this to my character.

    So with that in mind, am I using multiple global values here just for this feature? When I did more testing, and reset only one or two global values on the stage select frame, one of the items came back in the level frame, while the other items did not come back.

    So, I'm wondering, is it possible for me to use ONE global value just for ALL items whether its a 1-up, or power up? Or do the global values have to be different depending on what the power up/collectable item is?
    Example:
    Global Value B - 1-ups, health power ups, weapon power ups.
    Or does it have to be like this
    Global Value B: Health Power Up
    Global Value C: Weapon Power Up
    Global Value D: 1-up

    Keep in mind I have used the Group.Collectables qualifier for my power ups in my game. So I'm trying to figure out a way to correct this if possible.

  2. #2
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    You will need a different Global value for each.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  3. #3
    Forum Moderator Fusion 2.5 DeveloperHTML5 Export ModuleiOS Export ModuleSWF Export Module
    DavidN's Avatar
    Join Date
    Jun 2006
    Location
    Boston, MA, USA
    Posts
    4,044
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    For a store of multiple objects, you're probably better off spreading a value in them and then recording their picked-up state in some sort of array.

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    What?
    Global values are GLOBAL, you can't use the same one for multiple objects unless you want them to actually use the same value.

    Global Value A = Global Value(0), so if you actually used the globals starting from 0 this is why it overwrote your global value A and changed your character.

    Something like this should work: (using the global values starting at 50)

    Start of frame:
    = Spread Value 0 in Alterable Value A [Group.Collectables]
    Start of frame:
    = Start loop "items" for count("Group.Collectables") loops

    On loop "items"
    + Global Value(loopindex("items")+50) = 1
    + Alterable Value A of [Group.Collectables] = loopindex("items")
    = Destroy [Group.Collectables]

    Also notice me using the built-in loopindex() instead of a counter.

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,308
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    Quote Originally Posted by Dynasoft
    What?
    Global values are GLOBAL, you can't use the same one for multiple objects unless you want them to actually use the same value.

    Global Value A = Global Value(0), so if you actually used the globals starting from 0 this is why it overwrote your global value A and changed your character.

    Something like this should work: (using the global values starting at 50)

    Start of frame:
    = Spread Value 0 in Alterable Value A [Group.Collectables]
    Start of frame:
    = Start loop "items" for count("Group.Collectables") loops

    On loop "items"
    + Global Value(loopindex("items")+50) = 1
    + Alterable Value A of [Group.Collectables] = loopindex("items")
    = Destroy [Group.Collectables]

    Also notice me using the built-in loopindex() instead of a counter.
    Shouldn't your Start loop "items" for count("Group.Collectables") loops read like this instead?
    Start loop "items" NObjects("Group.Collectables") times.

    Anyway...... I used this format, and he STILL changes into another character (from global value A) when I pick up a health power up.
    Not to mention that the items I picked up come back when I restart the frame. X_X

  6. #6
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    You can use the associative array and set the key to Health (for example) and set it to 1.

    Your character picks up Health Power up
    >Set Global Value A to 1
    >Health Power Up: Destroy
    >Associative Array: Set Health to 1

    Next event

    If Health = 1
    >Health Power Up: destroy

    This way the health power up will be gone

    Save the associative array.

    When you restart the frame load the associative array if Global Value = 1.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  7. #7
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCSWF Export Module
    N64Mario's Avatar
    Join Date
    Nov 2008
    Location
    USA
    Posts
    1,308
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    Actually.... I'm trying to make a game engine with as little to no extensions as possible. Even if they are Clickteam's own, or extensions built with the software. X_X

    But I don't think that would be possible, even for when it comes time for me to set up a save feature, which would require INI to handle, I'd imagine. X_X

  8. #8
    Forum Moderator

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export ModuleInstall Creator Pro
    nivram's Avatar
    Join Date
    Jul 2006
    Location
    Bandon, Oregon
    Posts
    6,773
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    I have a INI++ example on my website that saves global values. I know you don't want to have to use extensions, but it sure makes life easier for the programmer.

    Good luck on your engine.

    Marv
    ​458 TGF to CTF 2.5+ Examples and games
    http://www.castles-of-britain.com/mmf2examples.htm

  9. #9
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    Quote Originally Posted by N64Mario
    Shouldn't your Start loop "items" for count("Group.Collectables") loops read like this instead?
    Start loop "items" NObjects("Group.Collectables") times.
    Yes, I was typing it from memory...

    Quote Originally Posted by N64Mario
    Anyway...... I used this format, and he STILL changes into another character (from global value A) when I pick up a health power up.
    Not to mention that the items I picked up come back when I restart the frame. X_X
    My guess would be a problem with where you are SETTING the global value then. Something like:

    Player collides with Group.Collectables
    = Set Global Value(Alterable Value A of [Group.Collectables]+50) = 1
    = Destroy [Group.Collectables]

    (relying on the spread value from the original code)
    Though I admit that I don't know whether "spread value" works on a whole group or just spreads the same value in each object in the group.

  10. #10
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: How do Global Value of objects work?

    It spreads it on all objects Im sure

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Help with Global Objects
    By YeOldeLuke in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 27th May 2013, 08:18 PM
  2. Compairing 'Objects AltValueA' to 'Objects AltValueB' dont work
    By King_Cool in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 8th May 2012, 12:27 AM
  3. Sometimes Global Objects
    By Krim in forum Multimedia Fusion 2 - Technical Support
    Replies: 10
    Last Post: 16th February 2012, 09:46 AM
  4. Global objects in global events
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 8th October 2010, 12:12 PM
  5. Global Objects
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 18
    Last Post: 22nd September 2007, 08:18 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
  •