Checking all touching(?adject?) table members, heelp

Started by
0 comments, last by Afterlife 22 years, 7 months ago
There''s a 2d table, from which I need to check all the members that are in contact to the middle member. The default value of a table "member" is 0. And if the middle one is 1 I need to go all directions and see how far the members with value 1 go and record them.
  
._._._._._.
|0|0|1|0|1| <= this 1 is not to be recorded to a table of the same type
|0|0|1|0|0|
|1|1|1|1|0| (<= the cheking should start here)
|0|0|1|0|1| <= this one neither, but the rest are
|0|0|1|0|0|
.-.-.-.-.-.
  
Hope you got the idea. (The reason for this is simple; roof. When the player is under a roof tile all adject roof tiles and including the one the player is standing under will not be displayed.) I''ve tried this many times, but I can''t even get the first line right (bugs bugs and more bugs). Could someone please demonstrate me a general logic to do this? (some code examples would be nice, because code is probably my main enemy here, not necessarily the logic) Thanks
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-
Advertisement
nm, I managed to fix0r my buggy version :6
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-

This topic is closed to new replies.

Advertisement