Select/manipulate an object from Family?

Get help using Construct 2

Post » Mon May 04, 2015 12:39 pm

Hello everybody. After some days of search i've decided to aks/post it here.

I have:

- Object 1
- Object 2
- Object 3
- A Family containing 2 Objects

I want:

- Object 1 in collision with Object 2, Object 3 subtract 1 from Health (i did this and working fine)
- On each collision between Object 1 and Object 2 (and after subtract 1 from Object 3 - like above), i want an (1) object from Family to set angle at X degrees (can this be possible?)

Why i want this? - The two objects found in Family, can be in other areas of the Layout so i don't want them to flip/set angle if in another area (when Object 1 and 2 collide), but only when they are overlapping Object 3 (or something else, another object, for example.)

To try to explain more simple, i would like, when Object 1 collides with Object 2 (and subtracts 1 Health from Object 3), 1 Object contained in the Familly to do an action (set angle for example).

So, as i see it, in theory would be - Object 1 on collision with Object 2, subtract 1 Health from Object 3 + If Family overlaps Object 3, set angle to X of an object from inside the Family. If Family (the 2 Objects inside) wont overlap Object 3, then no object from inside the Family will set angle. I hope i explained accurate, but if any questions please ask and i will tell.

Thank you all!
B
3
Posts: 6
Reputation: 185

Post » Mon May 04, 2015 9:39 pm

You won't be able to do this grabbing them as a family... since the whole purpose of the family is to allow you to act on whole groups of objects together.
However, you can still pick items from inside the family themselves without using the families pick...

If you only have 2 inside family then make two events, one saying in item1 overmaps, item2-set angle and another with item2 overlap and item1 set angle...

unless I am just not understanding what your trying to do. :)
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Tue May 05, 2015 12:08 am

does it matter which object from the family? you could pick random... that only picks one object.
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Tue May 05, 2015 8:05 am

@chrisinfinger - interesting ideea, but in time that family will have maybe 20 objects (or more) and also in time, i will have another object colliding and subtracting 2 or 3 from health, and i need on every subtract, the value i subtract will turn at X angle the objects in family.

@jobel - NO! it dosen't. I tought of that also, but don't know how to. Can it be done?

To add more info to what i want: On every X subtract, X object(s) from the Family (random or not) should set angle degree to X. For example, if on collision 2 Health will be subtracted, 2 objects from the Family will set angle, and so on.

Thank you both for reply!
B
3
Posts: 6
Reputation: 185

Post » Tue May 05, 2015 4:51 pm

tudort wrote:NO! it dosen't. I tought of that also, but don't know how to. Can it be done?


simple.

Code: Select all
Object 1 OnCollision with Object2
           System-> Pick Random <object>
                        Set <object> Angle etc...


for "object" you'd insert the Family you want.

tudort wrote: On every X subtract, X object(s) from the Family (random or not) should set angle degree to X. For example, if on collision 2 Health will be subtracted, 2 objects from the Family will set angle, and so on.


what is this first part? "On Every" on every what? tick? X seconds?

Is the number of family objects that you want the angle set have to do with how much is subtracted from the health?

if so.. make an instance bool variable called "selected" on the Family object..

Code: Select all
Odamage=2

If Object1 OnCollision with Object 2
     Repeat Odamage times
        Pick all Family
        Family is selected
             Pick Random Family
                   Family set angle
                   Family set selected to TRUE



after the collision is over you need to reset all the selected to false.
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Tue May 05, 2015 4:52 pm

best to post a dropbox link to a capx..
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Tue May 05, 2015 8:48 pm

Let me explain better what i wanna do:

1. Object "A" on collision with Object "B", Object "B" add n to Health.
2. Object "C" on collision with Object "D", Object "B" subtract n from Health.
3. After Object "B" subtract n from Health, n Object "A" set angle to 90 degrees but only if/when n Object "A" is overlaping Object "B".

(n can be any number)

Why only if Object "A" is overlaping Object "B"? Because i will have many Object "A" and i don't want them to set angle to 90 degrees if they are not overlaping Object "B", cos if so, they will be setting angle to 90 degrees while they are in other areas of the layout.

If you know the game "Magic: The Gathering", when you use a card, another card (resource card) will be Tapped (tapped means will set angle to 90 degrees) thus showing the player the card is "used". I want the card to be tapped when overlaping object B, and not be tapped when "in hand".

Thank you!!!
B
3
Posts: 6
Reputation: 185

Post » Sun May 10, 2015 7:06 am

Any help?
B
3
Posts: 6
Reputation: 185

Post » Fri May 29, 2015 5:36 am

Nothing?
B
3
Posts: 6
Reputation: 185

Post » Fri May 29, 2015 8:29 am

tudort wrote:1. Object "A" on collision with Object "B", Object "B" add n to Health.
2. Object "C" on collision with Object "D", Object "B" subtract n from Health.
3. After Object "B" subtract n from Health, n Object "A" set angle to 90 degrees but only if/when n Object "A" is overlaping Object "B".


So what part of this isn't working, it seems pretty straightforward..
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

Next

Return to How do I....?

Who is online

Users browsing this forum: dop2000, Yahoo [Bot] and 43 guests