Soldato
- Joined
- 15 Jan 2004
- Posts
- 14,199
- Location
- Hall
Say you're creating a sword, you could create an if statement, which checks array at the given random number, then checks the two array strings behind to see if the position is empty. If it is, then it sets all of the three array string values to 1.666, because that's what each is worth.
If any of the other squares aren't free, it should then check the two squares in front, then the two squares up and the two squares down, and if none of them are free it generates a new random.
If any of the other squares aren't free, it should then check the two squares in front, then the two squares up and the two squares down, and if none of them are free it generates a new random.
Good point.vonhelmet said:Just do it with a 2 dimensional array of 7 by 8. Much easier to create, easier to alter and easier to reference.
Last edited: