Need some assistance with node thingy sorting

Get help using Construct 2

Post » Mon Apr 27, 2015 9:39 pm

If that's ok with everyone, I would like get some assistance on my current problem/project :)

To describe it better I made this wonderful piece of art*, posted below.

In short. I have made some node based system, which works fine and almost like I wanted it to work. i don't like how it gets messed up if I try to add new nodes in specific places. They will start crumbling, overlapping and breaking everything on the way.

Then i thought it would be nice if nodes could automatically shift themselves up and down depending on their neighbours position. So they will alway have some space around them and will never overlap itself... and in overall will look cleaner.


Any help appreciated, and I really mean it!
(In return I ask my graphic designer to remade your avatar in style of our upcoming game xD)

And btw if someone have a nice idea to make better deleting nodes system I will be even more appreciated!



Image
*This image and content of capx file are copyrighted material and cannot be sold or used in any public or private places or application without written permission from the author - me.


Here's my file.
Double click on "Big Node" to remove it or add new one. "Small Nodes" are important but they have no functionality in this file - they are here because they need to be ;)

If something inside will look a bit weird just ignore it. It's a cropped down version of bigger thing. I removed everything not related and left only the important stuff for nodes to work.
node_help.capx
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,597
Reputation: 34,821

Post » Tue Apr 28, 2015 1:06 am

Hi,
I was tinkering with something similar a few months back. I was going for a replication of the way event sheets can be manipulated. What I came up for drawing the tree was have each node know what node was next and what it's first child was.

In a picture one possible tree could look something like this:
Code: Select all
node -> child -> node
 |                |
 v                v
next             next
 |                |
 v                v
node             node


Then to draw the tree I start at the root node and recursively position all the other nodes.

In this capx the relevant stuff is in the "tree layout" group.
https://dl.dropboxusercontent.com/u/542 ... _tree.capx
B
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Tue Apr 28, 2015 11:55 am

@R0J0hound

Ahh I see. Instead of repositioning each node one by one to their grid XY coordinates, like I did, You are arranging them based on the root.
Nicely done, Thank you!
ImageImageImageImage
B
157
S
66
G
41
Posts: 2,597
Reputation: 34,821


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 13 guests