Loading maps in java

Started by
3 comments, last by prof_89 17 years, 2 months ago
Hi, our game is making progress every day now.. http://www.freewebs.com/prof_89/appletgame/spel.html But as you see inte the source code (SOURCE koden) i have stored all my maps in the main program, wich is very disturbing.. I have tried to put them in a "mapsDB.class" file, in it i put the maps (int[][] map = {1,1,1,,1,1.....}... ) then i made a "public int[][] getMap1(){ return map[][];} then, in the main loop i did like this "int[][] map1 = mapDB.getMap1();" but i cant get it to work, i have tried with different methods but still it wont work, anyone that have any better ideas that works...?
Advertisement
You only need to
return map; // no [][]
. However you'll be much better off loading the map data from file, hardcoded levels aren't very nice to work with.
yeah, i think i have tried it biut i will try again


anf, applets cant load data files.... or ?
Quote:Original post by prof_89
yeah, i think i have tried it biut i will try again


anf, applets cant load data files.... or ?


they can, (should work just like loading images etc).

Hmm.. do you mean any applet or a like swing/JApplet thet can load files ?

This topic is closed to new replies.

Advertisement