Hi, Jamie.
And to the rest of you, I'm sorry, this explanation won't make much sense if you haven't looked at Jamie's code.
Jamie:
This is the line that is giving you trouble:
(I had to use "j" as the array's index instead of "i", because this Web site's UBB software interprets "bracket i closing-bracket" as "italicize".)
The problem is that ActiveMazeNumber equals zero here, but I think you want CurrentMazeNumber (which equals one). When I replaced the above line of code with
your game seemed to run fine: at least, it didn't generate any more NullPointerExceptions.
If you need to clarify between CurrentMazeNumber and ActiveMazeNumber, Jamie, I would definitely add comments to distinguish one from the other. And if you only need one defined, I'd get rid of the other one.
Also, I'm not sure about the line in ParseMapData() where you have
right at the
beginning of the method? If your intent is to someday have multiple maze definitions, and then build these arrays from your file mazes.maz, Jamie, I would recommend putting this incrementation somewhere at the end of ParseMapData(). In Java, arrays are zero-based, and not filling the "zeroth" element of your MazeData[] array led to some of the confusion here.
And just a little note, as an aside: instead of having to hard-code pi, you can use the constant Math.PI, from the package java.lang.Math. Also, constants are usually defined as "public static final", and their variables are usually capitalized, e.g.,
<PRE>
public static final int PLAYER_MAX_SPEED = 15;</PRE>
You can find some similar coding conventions that Sun recommends
here.
Hope this helps, Jamie.
Art
[This message has been edited by Art Metzer (edited April 02, 2001).]