action to object with value on collision?

Get help using Construct 2

Post » Thu Mar 17, 2016 10:43 am

Message: Vallar can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
A pick with evaluation action should do the trick.

Try the Capx I have linked below:

https://goo.gl/LPOZNq

EDIT: Fixed URL
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 17, 2016 11:31 am

Message: seawall can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Vallar wrote:A pick with evaluation action should do the trick.

Try the Capx I have linked below:

https://goo.gl/LPOZNq

EDIT: Fixed URL


Nooo, this not work, it give action to center sprite, i dont need give action to it i need check collision to it and give action to all others that directly collide to it. It makes center sprite opacy 50%, i need conneted sprites to it become 50% and dont touch others that not have direct collision to flag =1.
I need do that (i set opacy manualy to show):
Image
its that to hard to do?
B
5
Posts: 12
Reputation: 251

Post » Thu Mar 17, 2016 11:59 am

Message: Vallar can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I don't think it is too hard, no. But I couldn't understand what you need and the CAPX wasn't really enough. After all I am only trying to help.

Here is a method to do this:

https://goo.gl/c0u2gy


I cloned the same object and only changed the flag and its name. So they are 2 objects now (Flag0 and Flag1) but both look the same. Now you can just do a collision check and from that check you can do whatever action you want.

If you don't like this method, I suggest you wait for someone else's answer. Good luck!
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 17, 2016 12:31 pm

Message: seawall can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Vallar wrote:I don't think it is too hard, no. But I couldn't understand what you need and the CAPX wasn't really enough. After all I am only trying to help.

Here is a method to do this:

https://goo.gl/c0u2gy


I cloned the same object and only changed the flag and its name. So they are 2 objects now (Flag0 and Flag1) but both look the same. Now you can just do a collision check and from that check you can do whatever action you want.

If you don't like this method, I suggest you wait for someone else's answer. Good luck!

thanks, i need use 1 object i plan add many data to it, and this example shows how limited contruct 2 is.
B
5
Posts: 12
Reputation: 251

Post » Thu Mar 17, 2016 2:56 pm

I think it is more a limitation of my knowledge than Construct 2 itself. I would suggest waiting till someone else notices the thread and tries to help.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 17, 2016 3:20 pm

Try this:

Image

I'm not clear on what flag is supposed to be set where but you can change that condition to your likings.

EDIT:

You're actually just having issues with colliding with the same object. See this post's example capx. Construct is not very limiting at all but it does take some time to get used to how the picker works:

https://www.scirra.com/forum/collision-between-instances-of-the-same-object_p686645?#p686645

Good Luck!
B
33
S
10
G
4
Posts: 50
Reputation: 3,497

Post » Thu Mar 17, 2016 3:33 pm

I think what he is trying to do is the following:

Have a sprite instance with flag 1 and all other instances with flag 0. When flag1 sprite collides with flag0 sprites, flag0 sprites should have a set opacity to 25.

Meanwhile, it has to be the same exact object not a clone of it and you need to only set the opacity to the sprites that are colliding not the ones that aren't colliding with flag1 sprite.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 17, 2016 3:43 pm

Ok! Thanks @Vallar for clarifying that.

@seawall This does what has been described:
Image

EDIT: Added comments
B
33
S
10
G
4
Posts: 50
Reputation: 3,497

Post » Thu Mar 17, 2016 7:21 pm

I presume you dont have acces to famelies.

Allow me to offer you 2 warnings.
1/ I am not an expert.
2/ I am pretty sure that there is no easy solution.

Two more general things.
On Collision is a trigger. In your Cap none of the 'sprites' is moving. So its kinda useless to use On Collision. The trigger keeps firing.
Because the trigger keeps firing, your Cap is in a state of an endless loop. You should be more carefull with that.

Now. Your problem. Why is it not that easy?
Well, when using 'on collision' condition on all those 'sprites' a big list of sprites is returned as a result in the Selected Object List (official term, wich i call 'the picklist'). 15 in your case.

On top, you want to compare them in pairs.
Is one's flag 0 and the other one's flag 1, then do this(), if they overlap.

This Cap is one way to do it. The ListObject gives inside on whats happening. Lists are awsome debugging helpers.
https://
drive.google.com/open?id=0B1SSuCVV8v74RTkzNWVRS0llVXM

You will see 'pick all' conditions.
Why?
The conditions before those 'pick all' conditions narrowed down The Picklist.
The 'sprite' that needed to be tested was not any more in The Picklist.
Therfore, enlarge The Picklist was needed.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Mar 19, 2016 12:31 pm

broknecho wrote:Ok! Thanks @Vallar for clarifying that.

@seawall This does what has been described:
Image

EDIT: Added comments

this metod almost works, only problem its not work on start or block not moving, changing to overlaping not help.
i need make it work when blocks not moving.
B
5
Posts: 12
Reputation: 251

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: MassimoF and 23 guests