I am going to be taking on remaking the original NES LoZ in java, and I shall post progress on here as I go, but I felt like making a topic for this. Very Happy


So first thing is first, I need to learn how I can make maps using tilemap images.



That is the tilemap image, and I am guessing the best way to go about an actual map is with a 2D array, but what I can't figure out (even looking online and a lot of googling) is how I can use that image for a map.
I haven't the first clue, but goodluck getting this project going!
Each image tile has an index, and based on that index you crop the map image to get the tile. Or, when you first load the game, chop up the tilemap into an array of smaller images, and index into that array to get a tile.
Did you take a look at the example code from my Java RPGKit which I gave you on IRC a few days ago?
elfprince13 wrote:
Did you take a look at the example code from my Java RPGKit which I gave you on IRC a few days ago?


I did, but I honestly couldn't get it all figured out, along with that, I couldn't even get Eclipse to work with it. :/
Sonlen wrote:
elfprince13 wrote:
Did you take a look at the example code from my Java RPGKit which I gave you on IRC a few days ago?


I did, but I honestly couldn't get it all figured out, along with that, I couldn't even get Eclipse to work with it. :/
Can you ask more specific questions about what you couldn't understand? And what you couldn't get to work in Eclipse?
Sonlen wrote:
I did, but I honestly couldn't get it all figured out

You should figure it out or ask specific questions instead of asking us to give you the same code again. Start by reading the main method of the CeltQuest demo.

Sonlen wrote:
along with that, I couldn't even get Eclipse to work with it. :/

You shouldn't bother with Eclipse until you practice setting the compiler flags by hand, because you won't understand what Eclipse thinks is going wrong until you've had the same thing go wrong yourself.
I think we should resurrect that thread about asking questions the intelligent way to append a "be specific" section, although now that I'm writing this, I am thinking we might already have that. Anywho, specifics! Let's have 'em.
elfprince13 wrote:
Sonlen wrote:
I did, but I honestly couldn't get it all figured out

You should figure it out or ask specific questions instead of asking us to give you the same code again. Start by reading the main method of the CeltQuest demo.


I shall look into the main method and see what I get from that then. Very Happy

elfprince13 wrote:
Sonlen wrote:
along with that, I couldn't even get Eclipse to work with it. :/

You shouldn't bother with Eclipse until you practice setting the compiler flags by hand, because you won't understand what Eclipse thinks is going wrong until you've had the same thing go wrong yourself.


I have been using eclipse since I started, I will run it again and see what the console part says and post it.
Sonlen wrote:

I shall look into the main method and see what I get from that then. Very Happy

In general that's the best place to start in dissecting any program.

Sonlen wrote:

I have been using eclipse since I started, I will run it again and see what the console part says and post it.

If you aren't familiar with the command line arguments to java and javac, you should still set some up by hand.

Code:
java.io.IOException: The system cannot find the path specified
   at java.io.WinNTFileSystem.createFileExclusively(Native Method)
   at java.io.File.createNewFile(Unknown Source)
   at sfgp.rpgkit.MapGenerator.<init>(MapGenerator.java:28)
   at CeltQuest.CeltQuest.<init>(CeltQuest.java:93)
   at CeltQuest.CeltQuest.main(CeltQuest.java:74)
java.io.FileNotFoundException: data\map.cqm (The system cannot find the path specified)
   at java.io.FileInputStream.open(Native Method)
   at java.io.FileInputStream.<init>(Unknown Source)
   at sfgp.rpgkit.MapGenerator.readMap(MapGenerator.java:82)
   at CeltQuest.CeltQuest.makeMap(CeltQuest.java:341)
   at CeltQuest.CeltQuest.<init>(CeltQuest.java:94)
   at CeltQuest.CeltQuest.main(CeltQuest.java:74)
GAHHHHH!!!! WHAT A MORON!!!! SOMETHING IS BUSTED
...starting1
...not null
...starting2
...running


Any idea what is going on here? This is the issue I have had that I mentioned earlier. :/

Code:
java.io.IOException: The system cannot find the path specified
is a pretty good indicator. It can't find a file, based on:

Code:
java.io.FileNotFoundException: data\map.cqm (The system cannot find the path specified)

I'd say it's data\map.cqm. Does that file exist?
merthsoft wrote:

Code:
java.io.IOException: The system cannot find the path specified
is a pretty good indicator. It can't find a file, based on:

Code:
java.io.FileNotFoundException: data\map.cqm (The system cannot find the path specified)

I'd say it's data\map.cqm. Does that file exist?


I assumed it couldn't find the file, the source didn't have it, and I believe that file is generated in the running of the code to make a map. I am not sure though, just a guess from the code and seeing this:


Code:
public void setFile(File file){
   data = file;
   try{
      data.createNewFile();
   } catch(Exception e){
      e.printStackTrace();
   }
}


I also get an error with this message for the following code:


Code:
java.io.IOException: The system cannot find the path specified
   at java.io.WinNTFileSystem.createFileExclusively(Native Method)
   at java.io.File.createNewFile(Unknown Source)
   at sfgp.rpgkit.MapGenerator.<init>(MapGenerator.java:28)
   at sfgp.rpgkit.MapGenerator.main(MapGenerator.java:35)



Code:
public MapGenerator(int w, int h, String path){
   width = w;
   height = h;
   map = new int[width][height];
   try{
      data = new File(path);
      data.createNewFile();
   } catch(Exception e){
      e.printStackTrace();
   }
}



Edit: Found the map.cqm, I am going to try to re-direct the location to where it is at, as I think it is set up slightly differently since I did it and not elfprince.
Sorry I missed you on IRC.

Quote:
java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at sfgp.rpgkit.MapGenerator.<init>(MapGenerator.java:28)
at CeltQuest.CeltQuest.<init>(CeltQuest.java:94)
at CeltQuest.CeltQuest.main(CeltQuest.java:75)

This looks like an error writing the file. I suspect that your working directory is messed up by Eclipse (and or the data directory is missing).

Quote:
java.io.FileNotFoundException: data\map.cqm (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at sfgp.rpgkit.MapGenerator.readMap(MapGenerator.java:82)
at CeltQuest.CeltQuest.makeMap(CeltQuest.java:342)
at CeltQuest.CeltQuest.<init>(CeltQuest.java:95)
at CeltQuest.CeltQuest.main(CeltQuest.java:75)

This is related. Since the map wasn't created, it couldn't be read.
File paths are the pickiest things on the whole planet, besides maybe a worker in the fashion industry. Make sure that the path you're working with both is a valid one, AND when you do something like "data/map.dib" it applies to a folder "data" not in the path of the source, but of the compiled file. Most Java IDEs (well at least netbeans) will copy everything over from a project folder to a distribution folder, so that might not be the exact issue. If nothing else, try to clean up your path a bit and remove all garbage, keep things all in one organized place, and try rebuilding. Before you do that though, post the layout of the built project's class path, so we can see if it's set up correctly.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement