How do I Group Objects (Mixed) and Move?

Get help using Construct 2

Post » Thu Jun 02, 2016 12:11 pm

Hello,

Lets say, for example, I have a large sprite of a dialog box. Placed on the dialog box spite is also text, and two buttons.

If I dynamically move the dialog box in an event, none of it's components will move with it (text and two buttons) as they're not grouped.

I could, in the events on every tick tell the buttons and text to have the same positions as the dialog box with offset, but that just seems way too much work for something so simple! (What if I change the scale too?)

I could also add a 'Pin' component to the text and buttons, however this doesn't seem to work very well? If I were to reset the X position on the dialog box for example - the pinned elements will not follow respectably (bug?).

I found out that you can group objects together, and this is called 'Families' however, this is only for objects of the same type, which doesn't work for me.

I find it very odd that something so common to game development, or just general development for that matter, doesn't seem to exists on a widely used editor... Grouping?

Can someone please point me in the right direction? Thanks.
Last edited by oliverj777 on Thu Jun 02, 2016 12:31 pm, edited 1 time in total.
B
5
S
1
Posts: 15
Reputation: 349

Post » Thu Jun 02, 2016 12:23 pm

ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Thu Jun 02, 2016 12:31 pm

blackhornet wrote:https://www.scirra.com/manual/150/containers


Thanks, however this doesn't explain how I move 'grouped' objects. If I add the buttons and text to the dialog box container - it still does not follow the dialog box respectably.
B
5
S
1
Posts: 15
Reputation: 349

Post » Thu Jun 02, 2016 12:41 pm

Based on what you said above, it sounds like you pinned backwards. Pin the other items to the dialog box and move the dialog box. That should work just fine.
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Thu Jun 02, 2016 12:49 pm

blackhornet wrote:Based on what you said above, it sounds like you pinned backwards. Pin the other items to the dialog box and move the dialog box. That should work just fine.


I've added the Pin behaviour to my Text, and then on my event sheet: Every tick > Text_0 > Pin to > Dialog Box

Still doesn't follow my dialog box - Its worth noting that my dialog bot is being moved by LiteTween, would this affect the Pin Behaviour?

Thanks.
B
5
S
1
Posts: 15
Reputation: 349

Post » Thu Jun 02, 2016 1:34 pm

Okay, after checking out the example on Pin Behaviour, I changed the 'Every tick' to 'On start layout' and the Pin works fine.

However, the pin doesn't take into account the size of the object I'm wanting to pin. The dialog box 'pops' up from a 0% scale to a 100% scale tween. How can I get the other objects (buttons and text) to follow?

Thanks.
B
5
S
1
Posts: 15
Reputation: 349

Post » Thu Jun 02, 2016 1:47 pm

You can use Sprite or text set position to another object at every tick system
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Thu Jun 02, 2016 1:48 pm

Not sure, but i'd try this (propably not best practice):
1. Put your effect code in a function, since you want it to work more than one object.
2. Put your objects in a object family
3. Run your function on each family member and hand over your UID.
4. Pick your object by UID from the function parameter.
B
22
S
7
G
4
Posts: 154
Reputation: 3,709

Post » Thu Jun 02, 2016 2:34 pm

How are you doing the scaling now, specifically, in LiteTween?
ImageImageImage
B
71
S
22
G
247
Posts: 3,753
Reputation: 137,552

Post » Thu Jun 02, 2016 2:36 pm

blackhornet wrote:How are you doing the scaling now, specifically, in LiteTween?


Yes, using LiteTween : Create/Initialise tween : [Tween Property] Size (Pixel) > Start from the beginning.

Thanks.
B
5
S
1
Posts: 15
Reputation: 349

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 6 guests