Object overlap problem

Get help using Construct 2

Post » Fri Apr 12, 2013 12:02 pm

Hi there, I just started to work with construct 2 and I want to create a Ball Physics simulator but I have one problem. When I click somewhere on the layout I create a ball but I don't want to be able to create one of the balls on top of another. I tried to add a series of System.compare two values events or System.is between values but they don't work since they do not compare to every instance of the ball created, just with the first ball object. I hope I made myself clear enough. Thank you in advance.
B
3
Posts: 3
Reputation: 281

Post » Fri Apr 12, 2013 12:21 pm

@raz - What you could do is create a temporary object(about the same size as the ball) that checks for overlap - if the overlap is true, then don't create the ball. Something like this:

->On click - Create temporary object at click position
-->If temporary object overlaps ball object - delete temporary object,
-->Else - delete temporary object and create your ball object

In fact, you might even be able to just create the ball, immediately test for overlap and delete it if there is. I'm just not sure if that would cause a problem with physics or not, and I can't test it where I'm at...

Hope this makes sense...rogueNoodle2013-04-12 13:00:57
B
9
S
3
G
4
Posts: 63
Reputation: 3,083

Post » Fri Apr 12, 2013 7:11 pm

I just tested for overlap and it works...kind of...it also deletes the created ball, but that is actually better since now I can delete the extra balls that I want. Thx!
B
3
Posts: 3
Reputation: 281


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 19 guests