# Error selecting title in Array

**URL:** <https://forum.kirupa.com/t/error-selecting-title-in-array/274639>\
**Category:** flash\
**Created:** [November 1, 2008, 9:13pm UTC](https://forum.kirupa.com/t/error-selecting-title-in-array/274639 "2008-11-01T21:13:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitrocrime](https://avatars.discourse-cdn.com/v4/letter/n/ac8455/32.png) [@nitrocrime](https://forum.kirupa.com/u/nitrocrime)\
**Post date:** [November 1, 2008, 9:13pm UTC](https://forum.kirupa.com/t/error-selecting-title-in-array/274639/1 "2008-11-01T21:13:26Z")

</div>

Hello Kirupa users

I am working on a PathFinder  
It is working pretty well but i have a problem detecting walls

In my Array i only user 0 and 1  
The 0 is a walkable and 1 is a wall

I user this calculation to determen which title in the array i need to check for walls  
ActionScript Code:  
[LEFT][COLOR=#000000] **var** [/COLOR] tt1:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000000]([/COLOR]t1.[COLOR=#000080]y[/COLOR] \* [COLOR=#000080]5[/COLOR][COLOR=#000000])[/COLOR] + t1.[COLOR=#000080]x[/COLOR]  
[/LEFT]

But it is not working  
It is detecting walls at places where are no walls

And to check if the title is a wall or a walkable title is use:  
ActionScript Code:  
[LEFT][COLOR=#0000FF]if[/COLOR][COLOR=#000000]([/COLOR]map[COLOR=#000000][[/COLOR]tt1[COLOR=#000000]][/COLOR] == [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR]  
[COLOR=#000000]{[/COLOR]  
t1.[COLOR=#000080]ready[/COLOR] = [COLOR=#000000] **false** [/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]

This is my map Array:  
ActionScript Code:  
[LEFT][COLOR=#000000] **var** [/COLOR] map:[COLOR=#0000FF]Array[/COLOR] = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000FF]Array[/COLOR]COLOR=#000000[/COLOR]  
map = [COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],  
[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]1[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],  
[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]1[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],  
[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]1[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],  
[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR],[COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR];  
[/LEFT]

The t1.x and t1.y are the same as  
ActionScript Code:  
[LEFT][COLOR=#000000] **var** [/COLOR] cx:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]round[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000] **var** [/COLOR] cy:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#0000FF]Math[/COLOR].[COLOR=#0000FF]round[/COLOR]COLOR=#000000[/COLOR];  
[/LEFT]

But beacause you have miltile ways to walk(north east south and west)  
You must increase or decrease the value by 1 to get the right title spot  
I won’t include the code for that beacuse that is prety straight forward.

What am i doing wrong?
