# Is the gray piece surrounded by the red pieces?

**URL:** <https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404>\
**Category:** Uncategorized\
**Created:** [June 30, 2003, 2:35pm UTC](https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404 "2003-06-30T14:35:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jtubert](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jtubert](https://forum.kirupa.com/u/jtubert)\
**Post date:** [June 30, 2003, 2:35pm UTC](https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404/1 "2003-06-30T14:35:07Z")

</div>

![](http://www.jtubert.com/projects/games/cathedral/screenshot.jpg)

I’ve been working on this game for a little while and I got stock here.  
Does anyone know if there is a way to detect if a movie clip is surounded by other movie clips as it shows in the above picture.

You can look at the game at this url:

[Cathedral Game](http://www.jtubert.com/projects/games/cathedral/cathedral.html)

hope somebody can help me.

John Tubert

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 1, 2003, 9:44am UTC](https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404/2 "2003-07-01T09:44:30Z")

</div>

Have you tried hit testing those coordinates?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 1, 2003, 1:11pm UTC](https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404/3 "2003-07-01T13:11:26Z")

</div>

The gray piece in the middle(the cathedral) is surrounded by many pieces(red ones). The may be touching the cathedral or they may not, but if they are surrounding it the cathedral should dissapear.

any ideas???

thanks

JT

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 1, 2003, 3:39pm UTC](https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404/4 "2003-07-01T15:39:06Z")

</div>

Yup, see you can hit test coordinates. Your cathedral has 5 blocks that can touch red. There are 18 possible positions for surrounding red blocks. You can hit-test all of these coordinates pretty easily.

See what I mean? Like, cathedralMC would test (x,y):

(0,25);(10,25);(10,15);(20,15);…etc.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 1, 2003, 4:30pm UTC](https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404/5 "2003-07-01T16:30:07Z")

</div>

yes but there are many posibilities…the red boxes could be touching the cathedral or they could be far away and still surrounding the cathedral. How do I test that??  
Somebody suggested pathfinding algorithms…I’m taking a look at that.

thanks

JT

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 1, 2003, 5:05pm UTC](https://forum.kirupa.com/t/is-the-gray-piece-surrounded-by-the-red-pieces/24404/6 "2003-07-01T17:05:25Z")

</div>

Ah, I see, I’m gonna have to think about that one.
