|
Where do I put my .dat files? |
DJLad16
Member #14,857
January 2013
|
I've recently added some .dat files to my game to store the coords of my enemies and coins, it all works fine when I'm working on it. |
StevenVI
Member #562
July 2000
|
If they're in the same place as your sprites, and the sprites load yet the data files do not, are you specifying the paths differently when loading them? Make sure that your installer is setting the "working directory" for the app's shortcut to the same path that it is installed in. It looks like it's called "Start in" in Windows 7. Been a while since I even thought about that sort of thing. __________________________________________________ |
Dizzy Egg
Member #10,824
March 2009
|
Yeah, what Steven said! Basically the folder where your game runs whilst you're working on it will probably be very different to the folder it runs in when you install it! So you have to use a function to get the working directory as a string, so you can use something like this pseudo code load_dat_file(workingDirectory + "/datafiles/mydatfile.dat"). There is a way to do this using allegro, but I'm not going to tell you how, mainly because I can't remember ATM.
---------------------------------------------------- |
Neil Roy
Member #2,229
April 2002
|
Dizzy Egg said: So you have to use a function to get the working directory as a string, so you can use something like this pseudo code load_dat_file(workingDirectory + "/datafiles/mydatfile.dat"). There is a way to do this using allegro, but I'm not going to tell you how, mainly because I can't remember ATM. workingDirectory = al_get_current_directory(); --- |
LennyLen
Member #5,313
December 2004
|
It's good to see you were able to get loading your data from a file working. Just in case you weren't aware - you don't have to use the .dat extension on your files. I just used that with the code I sent you to as an example.
|
Arthur Kalliokoski
Second in Command
February 2005
|
NiteHackr said: al_get_current_directory() Isn't the OP talking about Allegro 4? They all watch too much MSNBC... they get ideas. |
LennyLen
Member #5,313
December 2004
|
Arthur Kalliokoski said: Isn't the OP talking about Allegro 4? No.
|
|