Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsShowcase → Roots for a game!
Roots for a game!
2009-03-09, 8:42 PM #1
Note - before you run the jar file, you need to edit one line in mapman.cfg:
Code:
imgfolder=e:\rpg\images\

to point correctly to the image folder.
For example, if you extracted the dist folder to the root of C:, you would change it to:
Code:
imgfolder=c:\dist\images\


I know, I know, the 32x32 pngs look like ***. I'm more concerned about code atm.
Attachment: 21484/dist.zip (87,471 bytes)
2009-03-09, 8:59 PM #2
Very cool, dude! good work

Also, I SEE DFLT OMG!
"it is time to get a credit card to complete my financial independance" — Tibby, Aug. 2009
2009-03-09, 9:04 PM #3
My only concerns at the moment are how to add different objects, such as rocks, npcs, and the like. I'm going to have them all be a subclass of a class Drawable, but I'm not sure how to give different qualities without a compiled java file for each type of drawable =/.
2009-03-09, 9:33 PM #4
Originally posted by Reid:
I'm going to have them all be a subclass of a class Drawable

You should probably use an interface for that.

Originally posted by Reid:
but I'm not sure how to give different qualities without a compiled java file for each type of drawable =/.

Uh, what?
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2009-03-09, 9:34 PM #5
Also you don't need to use absolute paths in the config file. Just use "images/" as the path.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2009-03-10, 5:00 AM #6
The map doesn't redraw when you drag the scrollbars.
2009-03-10, 7:25 AM #7
Thanks for noticing that, before I released I had it redraw the whole map and so I sloppily threw together some code that only redrew what was visible in the window. I'll throw together a Listener for the scroll bars.

Also, I'm going to look into the interface idea, I'm not super acquainted with them but I know why they should be better.
2009-03-10, 2:26 PM #8
Also, unless you're doing something significantly different from existing software, there's no reason to write yet another tile editor. So what are you doing different?
2009-03-10, 2:34 PM #9
That whole "it's been done a million times" gets old to me, Reid, good work keep it up
"Nulla tenaci invia est via"
2009-03-10, 2:34 PM #10
I imagine it's for learning.

Also, you should implement your GUI properly with layout managers. That way, the window contents can properly resize when you resize the window.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2009-03-10, 2:41 PM #11
Originally posted by Reid:
Also, I'm going to look into the interface idea, I'm not super acquainted with them but I know why they should be better.

Generally, you should use an interface when you want to define additional functionality that can be tacked on to any class. You should use an abstract class if you intentionally want to force your classes to inherit from it to get the functionality.

For example, there are probably many types of objects that can be drawn on the screen, so you should make Drawable an interface. A monster can be drawable, a tile can be drawable, an explosion can be drawable, etc. If you used an abstract class, all those objects would share a common ancestor, which doesn't make sense. Tile shouldn't be related to monster in that fashion.

Something like monster or creature would probably be an abstract class. Anything inheriting from it is, by necessity, a monster/creature. You don't want an interface because you don't want a tile that's also a monster -- that makes no sense.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2009-03-10, 6:17 PM #12
I see. Class Monster would implement drawable and all monsters would extent Class Monster.

Also, heres the code for a binary tree I plan to use:
Code:
/* * * * * * * * * * * * * * * * * * * * * *
 * BinTree.java
 * © 2009 Reid Booth
 * * * * * * * * * * * * * * * * * * * * * */
public class BinTree<V>{
	private String identifier;
	private V value;
	private BinTree<V> smaller;
	private BinTree<V> bigger;
	public BinTree(){
	}
	public BinTree(String id, V v){
		identifier = id;
		value = v;
	}
	public void setValue(String id, V v){
		if(identifier==null||identifier.equals(id)){
			identifier = id;
			value = v;
		}
		else if(id.compareTo(identifier)<0){
			if(lower==null){
				lower = new BinTree<V>(id,v);
			}
			else{
				lower.setValue(id,v);
			}
		}
		else{
			if(bigger==null){
				bigger = new BinTree<V>(id,v);
			}
			else{
				bigger.setValue(id,v);
			}
		}
	}
	public V getValue(String id){
		if(identifier!=null&&identifier.equals(id)){
			return value;
		}
		else if(id.compareTo(identifier)<0&&lower!=null){
			return lower.getValue(id);
		}
		else if(id.compareTo(identifier)>0&&bigger!=null){
			return bigger.getValue(id);
		}
		else{
			return null;
		}
	}	
}


I plan to add a remove method, but I'm not at a PC with a compiler so I can't test any code.

↑ Up to the top!