Check collision at position

Get help using Construct 2

Post » Thu Mar 15, 2012 12:46 am

Was wondering if there is a construct 2 equivalent of a gamemaker's place_meeting(x, y, object) or place_free(x, y) expression or condition? If not, may i suggest collision checking expressions/conditions for future builds. 8)

Thanks.PixelPalette2012-03-15 01:18:46
B
50
S
11
G
7
Posts: 274
Reputation: 8,146

Post » Thu Mar 15, 2012 1:43 am

Just put all the objects you wish to check for in a family, then make some sprite with a small collision polygon, which you place in that position, then check for collision with the family.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Thu Mar 15, 2012 2:24 am

[QUOTE=sqiddster] Just put all the objects you wish to check for in a family, then make some sprite with a small collision polygon, which you place in that position, then check for collision with the family.[/QUOTE]

How would i check if no collision happens? The problem is there is no invert for collision with object.
B
50
S
11
G
7
Posts: 274
Reputation: 8,146

Post » Thu Mar 15, 2012 2:42 am

I think you need to specify what you mean with "check if no collision happens". What is the situation you want to check?

But one way to go about that would be to instead use the overlap event. So you'd have

ObjectA is overlapping ObjectB: DoStuff

and invert that instead.
B
73
S
20
G
10
Posts: 524
Reputation: 9,896

Post » Thu Mar 15, 2012 3:07 am

[QUOTE=inkBot] I think you need to specify what you mean with "check if no collision happens". What is the situation you want to check?

But one way to go about that would be to instead use the overlap event. So you'd have

ObjectA is overlapping ObjectB: DoStuff

and invert that instead.[/QUOTE]

The thing is that the object does not overlap.

Here is the situation. I have a block tile that needs to check if there is collision bellow it (movement is based on 32x32 grid) if the space is empty it will drop down with a delay of 0.2 seconds at 32 pixel increments. If the space is not, it will stop moving. That's all i need it to do. Think of it as a tetris block that moves down after there is empty space bellow it.

Ideally though, for a none programmer like myself the place meeting and place free expressions helps me do this easily. So the absence of this would require a more inefficient manner of doing the same thing in C2.
B
50
S
11
G
7
Posts: 274
Reputation: 8,146

Post » Thu Mar 15, 2012 3:27 am

Thing is, objects that collide still counts as overlapping. Overlap and collide is essentially the same, with the difference that overlap is continuous.

But this is why I asked you what the situation was.

A simple solution is to, again, use overlap. You have a separate object, let's just call it Detector, and position it in the area where you want to check if objects are. Now, instead of using ObjectA to check for overlaps, we use Detector.

Detector is overlapping ObjectB: Move ObjectA

In CC you could check for overlap at offsets and not need another object, but it's not in C2 currently.
B
73
S
20
G
10
Posts: 524
Reputation: 9,896


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests