title: Cocos2d and tilemap collidable walls issue
body: <p>I'm trying to implement random movement of objects in the maze, so i made tilemap with collidable walls. I'm checking for collision for every direction in which object can move using such code:</p>
  
  <pre><code>int directionsCount = 4;
  CGPoint position = sprite.position;
  CCArray *newPositions = [CCArray arrayWithCapacity:directionsCount];
  CGFloat tileSize = _tileMap.tileSize.width;
  [newPositions addObject:[NSValue valueWithCGPoint:CGPointMake(position.x, position.y + tileSize)]];
  [newPositions addObject:[NSValue valueWithCGPoint:CGPointMake(position.x + tileSize, position.y)]];
  [newPositions addObject:[NSValue valueWithCGPoint:CGPointMake(position.x, position.y - tileSize)]];
  [newPositions addObject:[NSValue valueWithCGPoint:CGPointMake(position.x - tileSize, position.y)]];
  for (NSValue *value in newPositions) {
      int tileGid = [_meta tileGIDAt:[self tileCoordForPosition:[value CGPointValue]]];
      if (tileGid) {
          NSDictionary *properties = [_tileMap propertiesForGID:tileGid];
          if (properties) {
              NSString *collision = [properties valueForKey:@"Collidable"];
              if (collision &amp;&amp; [collision compare:@"True"] == NSOrderedSame) {
                  [newPositions removeObject:value];
              }
          }
      }
  }
  [sprite runAction:[CCMoveTo actionWithDuration:1.0f position:[[newPositions objectAtIndex:(CCRANDOM_0_1() * [newPositions count])] CGPointValue]]];
  </code></pre>
  
  <p>But in few cases when there is a dead end or if path turns down from right object is going thru the wall. Is there any idea how to fix such environment?
  Thanks.</p>