How do I check for collisions using 2 collision polys ?

0 favourites
  • 6 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi all, just wondering if there's a way to check what collision point has collided with another object?

    Basically.. I need to know if it's the left side or the right side?

    Ideally, I'd like to have 2 collision polys on the same sprite, if possible??

    I guess a cop-out way would be to have 2 underlay boxes, left and right, following the position of the main sprite. Then check them for collisions.

  • Just use the system pick overlapping point. Keep in mind its agnostic to left or right.

  • Two invisible sprites on each side of your object may be the easiest solution.

    You can also add two image points to the object and use "System Pick Overlapping Point" event. For example, if the image points are on sprite A and you want to check if the "right" point is overlapping sprite B:

    System: Pick SpriteB Overlapping Point (SpriteA.ImagePointX("right"), SpriteA.ImagePointY("right"))

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • One other way I've used to get the coordinates of a collision for round objects is to cast a los ray on collision, and use the hitx and hity expressions.

    If all you need is side though, helper sprites would probably be best.

  • Perhaps just check the objects x position to the center of your other object? Kinda depends on your game setup and movements, and you can use the poly from just 1 object.

    You could even add a custom image point acting as 'center' reference.

    On collision

    If ObjectA.x < ObjectB.Imagepoint('center')

    Object A is on the left, otherwise, its on the right.

  • Thankyou! - some good alternatives to try. :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)