how can i get the layout coordinates?

0 favourites
  • 6 posts
From the Asset Store
MM_Preloader
$19.99 USD
Various preloading features. Preload textures of entire layout, custom preloading, etc.
  • Hi everyone, I'm new and I don't speak much English, I apologize in advance for any grammatical errors :)

    I'm making a 2D platform and I need to get and store the x,y coordinates of the layout at the collision point between two objects, how is this possible?

    Specifically I need to get the x,y coordinates where my character lands on the floor.

    Thank you and good Construct

  • If you want to get the width and/or the height of the layout you can use:

    LayoutWidth and/or LayoutHeight.

    Hope it helps.

  • Not sure what your question is. You can save these coordinates to variables (global or local or instance).

    With Platform behavior the collision point will always be at the bottom of the sprite. You can add an image point there and use Character.ImagePointX("name"), Character.ImagePointY("name") expressions.

    Or set the origin image point at the bottom and simply use Character.X, Character.Y

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • when I say how to "get" the coordinates I mean what is the correct instruction that allows me to have the coordinates of the collision point between two objects. I haven't been able to find the right instruction that allows me to do this.

    I already use the image point but some animations (for image reasons) have different points of origin causing a divergence in the visualization of the sprite when it passes from one animation to another.

    By getting the collision point between two objects I could set the position of the sprite directly where I want the new animation to start.

  • Like I said, when a character with Platform behavior collides with with the ground, you can assume the collision point is at the bottom of the sprite.

    But for other scenarios there is no easy way to detect the point of collision between two objects.

    You can add several image points on the sprite A perimeter. And on collision with sprite B check which of these points overlap sprite B. (use System Pick Overlapping Point condition)

    Check out this demo, but note that it's pretty outdated:

    howtoconstructdemos.com/detecting-the-exact-point-of-collision-between-two-large-objects-capx

  • thank you very much, adding more image points to check for collision might be a good idea.

    I will also watch the demo for ideas

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