action to object with value on collision?

Get help using Construct 2

Post » Sat Mar 19, 2016 12:34 pm

99Instances2Go wrote: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.

You will see 'pick all' conditions.
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.

this metod only works on start, if i try change every coolision or every x second to update collision there will be big perfomance problem like 1 fps on 6 core 3gz CPU.
Posts: 12
Reputation: 251

Post » Sat Mar 19, 2016 6:00 pm

Alright I was fiddling with this more and the overlap condition in construct just reports ALL sprites that are overlapping and it's difficult to compare two objects of the same type with that. I don't see a reason why instead of using an instance variable, you just create a separate object, Doing this allows more power anyways and simplifies all that code I posted earlier to just this:


Sprite3 would be your "Flag=1" objects. Where the Sprite would be your "Flag=0" objects. Which gives this result:


This greatly simplifies your task and I believe produces what you want. If you ever needed to change an object your can just spawn a new one and delete the old one in it's place if needed. Instance variables can also be added to the if you have access to that.
Posts: 51
Reputation: 3,609

Post » Sat Mar 19, 2016 8:51 pm

Collisions is a total differend story. You provide a CAP with not 1 collision is happening. Then you complain that the solution only works for your CAP.

So, here is a CAP that understands collisions.


There is a Framedrop 4sure. But not because of de few events. Press the key to dissable the events.
Posts: 2,493
Reputation: 21,450


Return to How do I....?

Who is online

Users browsing this forum: visionarybeast and 11 guests