User Tag List

Results 1 to 10 of 10

Thread: Help with Array object

  1. #1
    Clicker

    Fusion 2.5 DeveloperAndroid 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)

    Join Date
    Aug 2008
    Posts
    98
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Help with Array object

    Hello!

    I'm trying to understand how an array works, but with no success.
    I researched several examples here in the forum, but the examples seem to be very advanced.

    I'm doing a simple game, I need to save and to load the position of 5 active objects (x and y position) in a 640x480 frame.

    Does anyone have a tip that can help me?

    I uploaded an example from the editor I'm trying to do.

    Many thanks to anyone who can help me understand how it works!
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,461
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    There is an extension called the "Save Game Object" that I believe does what you want. I would check it out.

    However, an array you use all the time. A single array is like a shelf you could place books on with each book given a number. You could label the books starting with Book 0, Book 1, Book 2 … etc. This is called zero based indexing. OR … You could label the books starting with Book 1, Book 2, Book 3 … etc. This is called one based indexing. Each Book is considered an element of a 1 dimensional array. To have you get a book, I simply tell you the index number.


    If you go to a post office and you use a PO Box for your mail, you are looking at a two dimensional array. Rows and Columns. To locate your PO Box you need two index numbers … row number and column number like PO Box 21 meaning row 2 and column 1.


    If you order a 24 carton (box) of Coke you are looking at a three dimensional array. Lets say it has 24 cans of Coke with 12 on the bottom and 12 stacked on top in a matrix. Now to locate a specific "Coke can" I would need to tell you the row number, the column, and the depth number (top stack or bottom stack).


    Lets say you and I decide to meet at a certain place and time. This is an example of a four dimensional array. For us to meet, I need to give you a latitude number, longitude number, a height number (on top of a mountain or building floor), and a time.


    As you see an array use an index(s) to located something. In your case you could create a two dimensional array like a spreadsheet with rows and columns.

    The size of the array could be five rows and three columns (Object_Name, X-Coor, Y-Coor). Some arrays will only allow you to store one type of data like all numbers or all strings. Some allow you to store both numbers and strings. Others will accept even more data like pictures, blobs, bits, bytes, files, etc...


    You access the data by giving an index. Well that is true in many cases. You need to read the help files and look at the conditions, actions. Anyway hope this helps.

  3. #3
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleMac Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,323
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Instead of a story, do it like this

    Do a write Active position x to array (1,1,0)
    Do a write Active position y to array (1,1,1)

    Do a write Active position x to array (2,1,0)
    Do a write Active position y to array (2,1,1)

    etc.
    Then at the end Save Array to file

    Then just Load Array from file
    set Active position x to Array (1,1,0)
    set Active position y to Array (1,1,1)

    set Active position x to Array (2,1,0)
    set Active position y to Array (2,1,1)

    etc

  4. #4
    Clicker

    Fusion 2.5 DeveloperAndroid 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)

    Join Date
    Aug 2008
    Posts
    98
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the explanations guys, but I canīt understand. I think I have some limitation with it. I'm trying to write some value in the x position of offset 1 but I canīt read that value in a counter. Anything that I do with arrayīs doesīt work.

  5. #5
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,461
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Then try the "Save Game Object"

  6. #6
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleMac Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,323
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    Here is your file modified, so you get the idea
    Attached files Attached files

  7. #7
    Clicker

    Fusion 2.5 DeveloperAndroid 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)

    Join Date
    Aug 2008
    Posts
    98
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Thanks!!! i will try it!

  8. #8
    Clicker

    Fusion 2.5 DeveloperAndroid 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)

    Join Date
    Aug 2008
    Posts
    98
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    Droberson, the save game object works, but it works more like a save state.
    When I close the application, open and give a load, it only loads 1 of the thousands of objects that I used as a qualifier.


    Perry, I think I have a problem, I still canīt understand your example file, because he did not worked it himself. I made all the code the way I understood and did a new upload. Please, if it will not disturb you, can you help me out?

    Thank you all!
    Attached files Attached files

  9. #9
    Forum Moderator

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleMac Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    Perry's Avatar
    Join Date
    Dec 2013
    Location
    Watertown, WI
    Posts
    4,323
    Mentioned
    44 Post(s)
    Tagged
    0 Thread(s)
    not sure what you don't understand.
    you said that you wanted to positions saved from the actives (i just grabbed one)
    all I did was take the X and Y position from the active and saved it in the array.
    Afterwards when you load it, it puts it back on those positions.
    It's up to you which actives you want to use.

    This is what you wrote "I'm doing a simple game, I need to save and to load the position of 5 active objects (x and y position) in a 640x480 frame."
    and I wrote down 1 active for the Array.
    You need to add the other 4 or 5 (since i grabbed 1 of those red ones)
    That shows you how you need to save the values and load it back in place.


    The save state from Droberson is a global save, and nothing else you can do with it.

    edit: you try to save a GROUP of actives. you can't do that with 1 x and Y.
    you need to make a loop and do it for each one of them. you said first it's for 5 objects.. now it's for 1000's ...

  10. #10
    Clicker

    Fusion 2.5 DeveloperAndroid 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)

    Join Date
    Aug 2008
    Posts
    98
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)
    I apologize, but I do not speak English and trying to write in this language leaves things a little confusing for me.

Similar Threads

  1. Bug with array object : array indexes change
    By Perfeks in forum Fusion 2.5
    Replies: 5
    Last Post: 22nd February 2017, 10:17 AM
  2. Array Object Vs Named Variable Object
    By AlanRuno in forum Fusion 2.5
    Replies: 3
    Last Post: 10th May 2015, 07:26 PM
  3. Loading an object from array when needed (loading an array in chunks)
    By fishrod in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 20th March 2014, 06:01 PM
  4. [BUG] Array object can't load if the INI object exists in any frame before it
    By happygreenfrog in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 15th August 2013, 06:17 AM
  5. Map Array Object
    By DistantJ in forum Extension Development
    Replies: 7
    Last Post: 23rd January 2008, 03:23 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
  •