How do I group objects together?

Get help using Construct 2

Post » Sat Oct 24, 2015 11:03 am

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.
B
6
Posts: 40
Reputation: 336

Post » Sat Oct 24, 2015 11:33 am

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)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Sat Oct 24, 2015 3:03 pm

The second solution suggested by RamPackWobble seems the best to me :)
B
12
S
7
G
7
Posts: 450
Reputation: 4,276

Post » Sun Oct 25, 2015 12:12 am

RamPackWobble wrote: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 :P

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.
B
6
Posts: 40
Reputation: 336

Post » Sun Oct 25, 2015 8:56 am

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
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Sun Oct 25, 2015 7:27 pm

Message: Knovolt is not yet permitted to post plain text URLS (300 rep required). 2 URLS removed. Why?
RamPackWobble wrote: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!
B
6
Posts: 40
Reputation: 336

Post » Mon Oct 26, 2015 3:21 am

RamPackWobble wrote: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
B
6
Posts: 40
Reputation: 336

Post » Mon Oct 26, 2015 9:43 am

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
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Oct 26, 2015 8:25 pm

LittleStain wrote: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!
B
6
Posts: 40
Reputation: 336

Post » Mon Oct 26, 2015 9:03 pm

Any chance you can post a link to your capx ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Next

Return to How do I....?

Who is online

Users browsing this forum: evillair, plinkie, YoHoho and 11 guests