View Single Post
Old Feb 19th, 2005, 3:29 AM   #2
ZenMasterJG
Hobbyist Programmer
 
ZenMasterJG's Avatar
 
Join Date: Nov 2004
Location: Boston, MA
Posts: 148
Rep Power: 4 ZenMasterJG is on a distinguished road
Send a message via AIM to ZenMasterJG
your program definatly can extract the info from a text file like this (check out class StreamTokenizer)
Text files are inefficient, however, and i dont particularly like how just anyone can go and mess around with them. Another possibility would be to create a class to store the information, save the data as objects to a file, and load it at start.

Your class would probably look somthing like:

public class SpriteData implements Serializable {
     private int pic, goto, wait, dx, dy, ifkeya, ifkeyb, ifkeyc;
     //etc, etc, etc
}

And then when you start the program you could load all of these objects onto a Vector or somthing, for easy access.
(For writing/reading objects to a file, check out class ObjectInputStream and ObjectOutputStream)

Last edited by ZenMasterJG; Feb 19th, 2005 at 3:30 AM. Reason: Screwed up my code tags. Damn you nyquil.
ZenMasterJG is offline   Reply With Quote