Crate Hinge to instances of objects?

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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:

    <img src="http://i25.tinypic.com/16a7b6g.png">

    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:

    + Spoke.value("currentSpoke") = 1
    [ul]
    	[li]Spoke: Create Hinge to Node at Image Point 0[/li]
    [/ul][/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.)
  • I apologize for bumping my own thread (it's kind of tacky), but does anyone have any ideas on this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

    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:

    <img src="http://i26.tinypic.com/27zx461.jpg">

    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:

    <img src="http://i28.tinypic.com/10dbips.jpg">

    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.

  • 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!

  • 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!

    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?

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