# Tilebased game - brick collision

**URL:** <https://forum.kirupa.com/t/tilebased-game-brick-collision/287879>\
**Category:** flash\
**Created:** [May 7, 2009, 11:46am UTC](https://forum.kirupa.com/t/tilebased-game-brick-collision/287879 "2009-05-07T11:46:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![swordfish1234](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@swordfish1234](https://forum.kirupa.com/u/swordfish1234)\
**Post date:** [May 7, 2009, 11:46am UTC](https://forum.kirupa.com/t/tilebased-game-brick-collision/287879/1 "2009-05-07T11:46:51Z")

</div>

Hi,

I’m workin on a tilebased game, with some black “draggable” bricks (when mousepointer hit the tile it goes to next frame, which is black). Now I want to check if the bricks are connected to each other. Also with some kind of counter, that displays which tiles that are connected.

I can’t use the hitTest function since the bricks will not touch each other.

Do I need to loop through and check each tile in 8 directions, or are there any better way for this?

Here’s a screenshot what I’m trying to do:  
[http://student.educ.umu.se/~thslon01/game/collisions2.html](http://student.educ.umu.se/~thslon01/game/collisions2.html)

The tiles are generated dynamicly.

I use AS 2 and Flash 8.

Thankful for some advise.

Regards,  
S-fish
