Well, as you just described it, to me it looks like the code your trying for is right there.
Your array is going to have the x,y set, and those points are going to be within the rect of your program. A simple repeat loop should tell you what the colors of each point are, I'd probably use something like
Code: Select all
// psuedo code
on [message]
repeat with x = 1 to the number of points of myArray
if the foregroundColor of x = "255,255,255" then set xValue to true
end repeat
end [message]
I used 'foregroundColor' because earlier you were asking about mouseColor, but really there are a LOT of other color arrangements you could test for.
If your game is using mouse clicks, it would be even easier, something like
Code: Select all
if the mouseColor = "white" then put "true" into xValue
Alternately, I could just be missing something blatantly obvious from your side not coming across in the description to me.
Took a look at your code (finally had some time, but am just waking up really). Curious about this part -
Code: Select all
function walkarea mPosition
set the screenmouseloc to Calculatescreenpos(mPosition)
if the mousecolor <> 255,255,255 then
put "P" into walkable
else
put "B" into walkable
end if
return walkable
end walkarea
I probably don't have my mind right, but why not something like
Code: Select all
function walkarea mPosition
set the screenmouseloc to Calculatescreenpos(mPosition)
if the mousecolor = "255,255,255" then put "P" into walkable
return walkable
end walkarea
Again, I don't know how much this game is using the mouse, but if your returning sLoc from calculating the screen pos, why not just get the color of sLoc?
Code: Select all
function walkarea mPosition
if the foregroundColor of sLoc = "255,255,255" then put "P" into walkable
// anything else isn't "P" and can be rejected as not walkable...
return walkable
end walkarea
I won't go into using globals and like that.