# Grouping true booleans in an array

**URL:** <https://forum.kirupa.com/t/grouping-true-booleans-in-an-array/331104>\
**Category:** Uncategorized\
**Created:** [May 17, 2013, 2:23pm UTC](https://forum.kirupa.com/t/grouping-true-booleans-in-an-array/331104 "2013-05-17T14:23:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BindleStick](https://avatars.discourse-cdn.com/v4/letter/b/8491ac/32.png) [@BindleStick](https://forum.kirupa.com/u/BindleStick)\
**Post date:** [May 17, 2013, 2:23pm UTC](https://forum.kirupa.com/t/grouping-true-booleans-in-an-array/331104/1 "2013-05-17T14:23:43Z")

</div>

I have an enemy hitting a bunch of tiles, and through a loop, I check all the tiles if the enemy is hitting them. I trace them and some will tell me if it’s true or false. I want to be able to get the enemy to randomly choose from those that are true, and go on those tiles. I was thinking of putting all of the hitTests that are true to be put into a separate array. Do I have the right idea, or is there another way of doing this?

```auto
for (var j:int = 0; j < tileset.length; j++){
               trace(tileset[j].currentFrameLabel, tileset[j].hitTestObject(enemy));
                     if (tileset[j].hitTestObject(enemy) && !tileset[j].tileMiddle.hitTestObject(player)) {
                            trace("true!");
                        }

```
