How do I make a secondary shape be able to attach and detach from a main shape?

0 favourites
  • 3 posts
From the Asset Store
Template for an alternative to falling shapes, fully documented in comments and video
  • I'm new to Construct and am trying to make a game where the user has the ability to select secondary shapes and attach it to a main shape, both in which are able to move independently from one another before being attached. If the main shape is moved, the secondary shape moves with the main shape. The user also has the ability to detach the secondary shape from the main shape and be able to still individually move each shape.

    I've tried searching the forums but was unable to find anything. I was able to get the shapes to attach to one another and move together but wasn't able to figure out how to detach the secondary shape from the main shape.

    This is what I have so far:

    Here is an example video that shows what I'm trying to create.

    Subscribe to Construct videos now
  • You're not far off. I prefer using hierarchies to pin, but whatever works for you is fine. Anyway, here's how I would do it:

    + MainShape: DragDrop is dragging
    ----+ SecondaryShape: On collision with MainShape
    -----> MainShape: Add child SecondaryShape (X: True, Y: True, width: True, height: True, angle: True, Z elevation: True, destroy with parent: False)
    
    ----+ SecondaryShape: [X] Is overlapping MainShape
    ----+ System: Trigger once
    -----> MainShape: Remove child SecondaryShape
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • GeoffB I ended up switching to a different game engine but thank you for your advice!

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