Crate Hinge to instances of objects?

For questions about using Classic.

Post » Fri Mar 28, 2008 10:52 pm

Okay, I'm trying to build a blob.

Here is my inspiration:

http://cowboyprogramming.com/2007/01/05/blob-physics/

I've had a little success making small blob constructions of nodes and cross-bars, but I've had to make each node and crossbar a separate object and attach each piece by hand with Create Hinge. And simple blobs with only a few sections don't behave very well.

I thought I could automate the process with loops to create a larger, more complex blob. Here's the blob I want to make:



It has a total of 33 nodes, 16 outer walls, 16 inner walls, 16 outer spokes, 16 inner spokes, and 16 crossbars. That's a grand total of 113 objects.

Now, I could go and make each object separate, but that would be tedious. And I could go and make Create Hinge actions for each object separatly, but that would be SUPER tedious... the outer nodes have 4 connections each, the inner nodes have 5, and the center node has 16. So that's a total of 160 or so Create Hinge actions I'd have to code in the event sheet on top of that.

That's a lot of work. I'd much rather just make one of each and use a loop to duplicate and attach them.

I can automate the spawning of all the objects and put them in the proper position for attachment. That's no problem. The problem comes with attaching hinges from one object to another...

When I pick an object, I can pick it by it's private variable and Construct knows which object I'm interested in. But when I do this:

[code:3pdxtf9q]
+ Spoke.value("currentSpoke") = 1
- Spoke: Create Hinge to Node at Image Point 0
[/code:3pdxtf9q]

Construct has no idea which node I mean, because there's no way to specify which second object I'm interested in manipulating.

Or is there? Is there some method that I'm missing? Or is this beyond the scope of Construct at the moment?

(And yeah, this has to do with the polygon drawing thing I asked about earlier... eventually I want to make the blob parts invisible and just draw the outline around the blob, I just thought I'd get the easy part out of the way first.)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Mar 31, 2008 7:12 pm

I apologize for bumping my own thread (it's kind of tacky), but does anyone have any ideas on this?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Mar 31, 2008 7:36 pm

Hmm... just had a quick look and some rough ideas:

If you add the node to a family, you can use that family as a separate way of picking objects in conditions (they keep different selected-object-lists). It's a handy way of picking different instances from the same object type.

However, it's clearly complicated enough to warrant built-in functionality, IMO. Even if you pull it off via events, it'll be nontrivial, and easier to just tick the boxes for a blob or something.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Mar 31, 2008 7:51 pm

I've been struggling with that one too and couldn't get it work. I even tried something similliar what Ashley told but it didn't work. I managed to make hinge between two sprites by colliding them together in one frame and then taking them back to their original position, but it made two way hinge... Have to keep trying.
B
64
S
21
G
9
Posts: 154
Reputation: 7,034

Post » Mon Mar 31, 2008 8:57 pm

[quote="Ashley":d03jnfuq]Hmm... just had a quick look and some rough ideas:

If you add the node to a family, you can use that family as a separate way of picking objects in conditions (they keep different selected-object-lists). It's a handy way of picking different instances from the same object type.

However, it's clearly complicated enough to warrant built-in functionality, IMO. Even if you pull it off via events, it'll be nontrivial, and easier to just tick the boxes for a blob or something.[/quote:d03jnfuq]

Perhaps something like, in the object picker you could have the option to pick an object via an expression. Something like a qualifier.

Like so:



Clicking an object in the picker would load the object name into the Qualifier field automatically. If I wanted to just perform the action on any old innerNode object, I would leave it like that.

But if I wanted to I could define the qualifier with an expression, like so:



Just the first thing I thought of. I don't know how easy it would be to implement, and I'm sure there are better methods, but I'm just throwing ideas out there.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Mar 31, 2008 9:02 pm

Well the SDK can create objects - so I think we could just add a 'Spawn blob' action to Physics. It would make the instance that had the action called the central node, and spawn other node objects automatically hinging them together, with customisable number, radius etc.

I don't know when this can be done, but I think its the best idea!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Mar 31, 2008 9:10 pm

[quote="Ashley":1229nnhx]Well the SDK can create objects - so I think we could just add a 'Spawn blob' action to Physics. It would make the instance that had the action called the central node, and spawn other node objects automatically hinging them together, with customisable number, radius etc.

I don't know when this can be done, but I think its the best idea![/quote:1229nnhx]

That would be pretty sweet, but there are plenty of other uses for defining which specific instance to target when performing actions. What do you think of my Qualifier idea, or perhaps some other method that I've overlooked?
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests