2d array trouble - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: 2d array trouble (/thread-4777.html)
2d array trouble - saxplayer13 - Nov 20, 2005 08:23 PM
ok. I'm having a lot of trouble getting my 2d array to work.
here's my array code:
My first problem was that accessing the last one in an array (badwordarray), and multiplying it by -1 would effectively multiply the first in the next row (badwordarray) by -1 as well. This is bad because the first in the array is supposed to be a map number, and so far, I am not using negative numbers for map numbers. I fixed this first problem by inserting the useless line of -1s.
My latest problem is that when trying to access the last integer, badwordarray, it returns a -4. As that is speed, now my enemies are moving 3 extra tiles, and completely missing all the walls inbetween.
If anyone has some time, help with either of my problems would be appreciated. I am new to Cocoa/Objective-C, so it is probably something simple I overlooked. I could post my whole code if necessary, but I bet it is just a generic array issue.
2d array trouble - OneSadCookie - Nov 20, 2005 08:25 PM
int array; means there are 5 positions, numbered 0..4
2d array trouble - saxplayer13 - Nov 20, 2005 08:32 PM
Darn. I knew that too.
Thanks for your quick reply.
"Now I can focus on my crippling emotional pain. Oh Daddy, why won't you hug me?" ~Moe from the Simpsons