How do I Pick object by overlapping and by distance between two sames objects ?

0 favourites
  • 2 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • Hello everyone,

    I try to make puzzle game like match 3 but more simpler.

    I make this simple script, but when I launch it every green block destroyed.

    I want to destroy green block if it's touching same more than 3 time, and only this specific block.

    I try to do this with invisible object and say is overlapping this area. It's work but I have to put this area everywhere.

    I try to do whit distance between two block but he did'nt work.

    I don't know if my question is understandable, but I just want to destroy green block if if he hits more than three blocks.

    Thanks for helping me !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Put the green block onto a family. For each green block, check if overlapping family at all four orthogonal positions. If it is, add 1 to a counter variable. If the counter variable is greater than 2, delete the green block.

    Of course, this changes if the next block you check might have had more 3 adjacent blocks before deletion, so you've got a game logic issue to solve even before implementation. If you place a block that results in two adjacent blocks needing to be deleted, which one gets deleted?

    You might be able to get around this by flagging the block with another instance variable instead of deleting it right away, then delete all flagged blocks at the end of the tick.

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