Computer Science Canada Walls For a Snake program |
Author: | bigr [ Wed Apr 21, 2004 11:06 am ] |
Post subject: | Walls For a Snake program |
Hey this is my basics so far for a snake program i made. could someone help me with what the wall code would look like. Thanks btw i was hoping the walls would be random like how they are on this snake game. http://www.addictinggames.com/worm.html |
Author: | Dan [ Wed Apr 21, 2004 12:26 pm ] |
Post subject: | |
well the easyest way to do this whould be to uses whatdot color constion dection. witch u can find out more about here: http://www.compsci.ca/v2/viewtopic.php?t=2381 that idea whould be to draw random walls and obsticals that are not the same color as the backgorund or sank and then chech the color of the pixels on or close to the snake. if they are not the background color or the snake color then the snake has hit somting. this could also be done with out whatdotcolor, you could keep track of all the pxiels in an array of boolean where true means the snake can not go there and false means it can. then u whould have to check this agested the curent postion of the sanke. this could also be used in a way to make rnadom walls by making an array witch has randomly amounts of pixels add to the top of the col and the end of it. |