How do I group objects together?

0 favourites
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Much like in other programs such as Photoshop, you can group together objects. Can you do the same in construct 2?

    For example, there are 3 squares. How would I combine/group the 3 squares together so that they become one object? I want this because it's a hassle writing events for all of the separate objects when I just want to set a new position etc.

    Thanks in advance.

  • In the paid for version there are families - with these you could (for example) add your three squares into the family and the do things like family.x=family.x+10

    you could also give the squares an instance variable (eg ivGroup) and the choose the square by selecting by instance variable and then move all the selected

    you could pin objects to another and then when the other object moves so will your squares

    also look at containers (stil not sure if they are in free version)

  • The second solution suggested by RamPackWobble seems the best to me

  • In the paid for version there are families - with these you could (for example) add your three squares into the family and the do things like family.x=family.x+10

    you could also give the squares an instance variable (eg ivGroup) and the choose the square by selecting by instance variable and then move all the selected

    you could pin objects to another and then when the other object moves so will your squares

    also look at containers (stil not sure if they are in free version)

    How I envy the premium version now

    Anyways how would you "choose the square by selecting by instance variable".

    Pin is a nice feature, but when I have objects that consists of like 3+objects (3+ squares for example), the event page becomes so repetitive, and thus I'm not sure that's the correct way to do it.

  • I have been told that containers are in the free version.

    example of grouping objects together using instance variables

    https://goo.gl/NtujPt (r216)

    example of grouping using container

    https://goo.gl/XaQv7C

  • I have been told that containers are in the free version.

    example of grouping objects together using instance variables (r216)

    example of grouping using container

    Damn those light bulbs, been just messing about in preview mode for about 5 minutes before I realised I was there to learn XD

    Anyways thank you so much for the capx and those notes, helped soo much!

  • I have been told that containers are in the free version.

    example of grouping objects together using instance variables

    example of grouping using container

    Sorry to bother again, but how do I stop this from happening? Posted a GIF below.

    Basically, I can still click the light bulb underneath the overlapping light bulb (shown by how I can still turn the bulb on+off).

    Thanks.

    gyazo.com/1f6a7f2a4ecd32b878b5bfb564c70ea2

  • When clicking/touching collision is detected for all objects under your touch/mouse..

    If you want only the top instance to react:

    on lightbulb touched/clicked

    lightbulb pick top (instance)

    add your actions

  • When clicking/touching collision is detected for all objects under your touch/mouse..

    If you want only the top instance to react:

    on lightbulb touched/clicked

    lightbulb pick top (instance)

    > add your actions

    Thanks for the help, worked great in your project, but couldn't get it to work on mine.

    So I did when "button" is clicked, with condition "instance variable A" is = 0, you can click the button. Then I had an action to set "instance variable A" to 1, then system spawn new object "button(copy)". And I believe the new copied button still has default "instance variable A" as 0, so I can still click it.

    Learnt alot from your project, and will keep the pick top/bottom instance for future reference!

  • Any chance you can post a link to your capx ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want to move one object and have the child objects follow, you can always use the Pin behavior.

  • Any chance you can post a link to your capx ?

    Sure here are two, "Experiment 3" is the one with working stuff. "Experiment 3 copy" is an example of which the problem is existing.

    (Note: Test "experiment 3 copy" by clicking the red button, and then clicking the spot where the 1st red button is underneath the blue square. You can still click that when you don't want it to!)

    BTW this capx is so ghetto and 100% not the most efficient way to achieve this

    Experiment 3

    dropbox.com/s/0gf49gusnsylymb/experiment3.capx?dl=0

    Experiment 3 Copy

    dropbox.com/s/wxkbaqcvi1ntgzp/experiment3%20-%20Copy.capx?dl=0

  • If you want to move one object and have the child objects follow, you can always use the Pin behavior.

    Don't worry, I got the problem solved, but in a messy way ha. Check out the post above/the 2 capx files if you're interested.

    I needed a second button to appear exactly like in the capx, instead of moving the first button to where 2nd button position was.

  • Sorry I have had a couple of chaotic days with no time for C2

    I will have a look tomorrow.

    Edit 28/10/15

    10pm and my computer is back up and running

    I will have a look tomorrow. (sorry)

  • Not 100% sure of your intention but one thing that does stand out the unnecessary "every tick" with the sub events - try removing that...

    also the first ("line" 2) where you are making sprite and sprite 2 invisible ?

    Sorry for the delay.

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