Computer Science Canada Two dimential array map grid???? |
Author: | kirstenpratt [ Wed Feb 28, 2007 3:57 pm ] | ||
Post subject: | Two dimential array map grid???? | ||
Hello, im making a pacman game for a school project, i used a picture for the background, and was trying to use lines, and Math.DistancePointLine but a person told me to find out how to solve the problem better, well first off my problem is that my pacman eats the background, and i need to make a 2 dimentional array to say were pacman can go and cant go, i looked at the toutorials , but i still dont get how to make it so it will work. Please if u can post a solution to this probleme if you have had it before, or even explain 2 dimentional arrays and how to use them to make a grid, thank you please respond =D here is my code;
Thank you =P |
Author: | BenLi [ Wed Feb 28, 2007 5:03 pm ] |
Post subject: | RE:Two dimential array map grid???? |
okay, you need to understand one dimensional before you venture into multi dimensional arrays. So basically, an array is a mass of variables that are know by one name but referenced by numbers. I suggest doing the questions that the tutorial suggests you complete to acquaint yourself with the concept |
Author: | CodeMonkey2000 [ Wed Feb 28, 2007 6:50 pm ] | ||||
Post subject: | Re: Two dimential array map grid???? | ||||
Here is some code using 2d mapping. I commented it as best as I could. Hope it helps.
Oh and here is a sample map I created. Just save it as map.txt
|
Author: | kirstenpratt [ Wed Feb 28, 2007 9:27 pm ] |
Post subject: | Re: Two dimential array map grid???? |
ok thankyou your code is awesome but how can i fit that in with my pacman?i dont get it if you could can u help thank you so much |
Author: | CodeMonkey2000 [ Wed Feb 28, 2007 10:33 pm ] |
Post subject: | Re: Two dimential array map grid???? |
What part don't you understand? If it is about 2d arrays there is a tutorial about it here (just scroll further down in the thread, it is a few posts down)http://www.compsci.ca/v3/viewtopic.php?t=14333. If it is about file input/output there is a tutorial herehttp://www.compsci.ca/v3/viewtopic.php?t=12972 |