Re: Final Fantasy 2 based game source code
Turtle Wizard wrote:
Final Fantasy 2 based game written in Java : source code GPLv2 :
http://code.google.com/p/angels-destiny-rpg/
- You should follow the Java Coding Conventions, at least as far as indentation and
naming are concerned.
- Consider encapsulating the long initialization sequences in methods of the class
being initialized.
- Sequences like
public Image getFirstCharacterLeftImage(int idx)
{
return firstplayercharacter.getLeftImage(idx);
}
public Image getSecondCharacterLeftImage(int idx)
{
return secondplayercharacter.getLeftImage(idx);
}
public Image getThirdCharacterLeftImage(int idx)
{
return thirdplayercharacter.getLeftImage(idx);
}
...
are clumsy programming. Those should be calls the the same method,
e.g., 'getLeftImage()', from each of the first, second, third, ... instances of
some sort of 'GameCharacter' type.
What you've done is the antithesis of object oriented.
- Eschew import-on-demand for single-type imports.
- Your hierarchies are strange, for example 'CityNameDatabaseBase'. Why is that split
into two types?
- Speaking of 'CityNameDatabaseBase',
protected LinkedList words = new LinkedList();
DO NOT USE RAW TYPES! YECCCH!
Declare the variable as a 'List<Something>', or 'Set<Something>', or 'Collection<Something>'.
And why did you select 'LinkedList' for the implementation? Didn't 'ArrayList' suffice?
And really, shouldn't it be a 'Set' (to avoid duplicates) rather than a 'List'?
- Object o = words.get(index);
String s = (String)o;
This is why you don't use raw types. And 'o' and 's' are nasty variable names.
- "Copyright (C) <year> <name of author>"
Really?
- This is not how to do i18n:
if (language == "Dutch" || language == "dutch") {
textlib.addText("Er is onrust in het Oosten..");
textlib.addText("een oud kwaad is aan het herrijzen..");
//set to "-1" for not popping up the learn widget
learnvarlib.addText("-1");
learnvarlib.addText("-1");
asktextlib.addText("Aangenaam.");
itemtextlib.addText("Hopelijk heb je het niet nodig.");
learntextlib.addText("Dulandar is dit elfen dorpje.");
learnedanotherwordtextlib.addText("Elfen dansen en zingen graag.");
Use resource bundles. That's what they're for.
And so on and so on.
I don't know how to evaluate beginner projects, but you have a ways to go.
You need to learn object-oriented programming, and Java.
--
Lew