Need advice on: Building a hierarchy tree

0 favourites
  • 6 posts
From the Asset Store
77 Hi-Res realistic Trees over transparent background. Variety of species and seasons.
  • Hi

    I could use some advice.

    I want to build a infinite hierarchy tree.

    I can build the basics myself but there is one thing that is keeping me back from pursuing the build myself.

    I'l explain.

    The tree functions as follows:

    The user puts a name in a textbox.

    The name becomes a node on the branch of a tree.

    The user puts in another name and selects a parrent node from a dropdown list, then a new branch is created(with the new node on top).

    When the user has put al the nodes in he wants, he saves his progress and then exits the application.

    On the next start of the program all last saved nodes are automaticly loaded.

    The user then can continue building his hierarchy.

    Now to the point.

    I can figure out 90 procent of how to do this.

    The one thing i cannot, is the save part.

    I understand there is the webstorage plugin. (With its limits)

    I also understand there is the ajax part of things. (needs knowledge on php and servers)

    And i understand that construct 2 "at this point" does not have a save game state to server option. (Which if it would, just "saved" my day)

    The point i need advice on is the question.

    Is what i am trying to accomplish to difficult, for the stage of developement construct 2 is currently in?

    A: If yes, then i would have a programmer i'm in contact with build this app for me.

    B: If no, then i would really like to build it myself.

    As building in construct 2 has become quite an adventure.

    <img src="http://www.ruimteschool.nl/Concepttree/Concepttree.jpg" border="0" />

    Thank u in advance for any advice. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • If you create the tree automatically, with math expressions (angle and etc), you just need the nodes info.

    You can save each node indexed by UID's node.

    The string saved would be parentUID-nodeLabel.

    Iterating your tree example to the left, we have:

    Key(0): -Concept Tree

    Key(1): 0-JP

    Key(2): 1-? (don't have the euro symbol here)

    Key(3): 1-WebApp

    Key(4): 3-User

    Key(5): 4-Creatie Meting

    Key(6): 3-User

    Key(7): 6-Creatie Meting

    A key for qtyNodes is nice too, so you can loop using it as index.

  • Cassianno

    Thanx for the fast reply.

    2 questions.

    1: What do u mean by: A key for (qtyNodes) is nice too, so you can (loop using it as index).

    2: What save method do i use in your example: Webstorage or Ajax?

    The tree should be created automaticly indeed.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Webstorage is like a cookie: you have a key and the stored value.

    1)

    In this example your webstorage would have 9 keys:

    qtyNodes, storing the quantity of nodes you have on the tree and the nodes itselves (dunno if this word exists but u know what i mean), indexed from 0 to 7 (amount-1).

    2)

    It's up to you. I would go with webstorage because the setters/getters are easier to manage. Withing AJAX, you would have to make a request for every node and get its info...

  • Oh, your question was about the loop part, rite?

    To create the tree, you'll have a

    system Repeat WebStorage.Local("qtyNodes")

    - index++;

    - allocate the current (WebStorage.Local(index)) node within the tree {...}

  • Thank u for the advice!

    I think i understand!

    Il start building using your method and report back in the future <img src="smileys/smiley17.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)