[SOLVED]How do I found out what an image is touching?

0 favourites
  • 3 posts
From the Asset Store
Elevate your games with our AI Chatbot Integration! Seamlessly connect your Construct 3 projects with GPT-4 for dynamic,
  • I have rows and columns of blocks and I need to store in instance variables all the blocks it's touching and where it's touching them.

    For example:

    aboveUID =

    belowUID =

    leftUID =

    rightUID =

    I've created image points on my sprites for left, right, top, and bottom but I'm not sure where to go from there.

  • You can create a family with this block object and use an event like this:

    For each Block
    System pick BlockFamily overlapping point (Block.imagePointX(1), Block.imagePointY(1))
     Block set aboveUID to BlockFamily.UID
    

    However, this seems to be a very complicated and inefficient system.

    If you are making a grid of blocks, consider using a TileMap. Or, if you need to do it with sprites, use a pair of variables GridX, GridY. This way you can easily pick a neighboring block on any side, or even on a diagonal. For example, to pick a block on the right: GridX=(CurrentBlock.GridX+1), GridY=(CurrentBlock.GridY)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks!

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