The Best Ways to Affect Only Linked Objects

Get help using Construct 2

Post » Thu Aug 28, 2014 7:19 am

The description may be misleading, but I'm not sure exactly how to word this.

I'm just wondering what the most efficient ways to link (or group) objects and manipulate them individually. As you see below, I have a building which can be destroyed with it's health displayed overhead. The display, health bar, arrow, and building are all separate and are all controlled separately. Since there will be more instances of the destroyable building onscreen at any given time, I'd need a way to link the health and building sprites so the programming doesn't get confused. Pretty common issue, but all the ways I know to do this take a lot of events or individual objects to program.

Image

What I am wondering is what are the easiest ways y'all have found to put objects into groups or link them together?
B
15
S
4
G
1
Posts: 169
Reputation: 2,179

Post » Thu Aug 28, 2014 7:27 am

Have you looked at using a container? That can help with some aspects of 'grouping' objects together.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Aug 28, 2014 9:42 am

As @Codah said, you would probably be helped a lot with containers

https://www.scirra.com/manual/150/containers
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 » Thu Aug 28, 2014 9:38 pm

@codah @LittleStain
I didn't know events on the container only affect objects in the container. Huh. I was avoiding containers mostly because destroying the building when it's health drops to 0 would also destroy the bar indicator and arrow sprites, but there are easy ways around that now that I know!

Thanks, guys!
B
15
S
4
G
1
Posts: 169
Reputation: 2,179

Post » Thu Aug 28, 2014 10:53 pm

No worries, they are useful mainly in saving you doing a lot of picking of related objects. Families are another way to group (more categorise) objects.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, Buddhika, R0J0hound and 15 guests