Recommended Posts

Hi, I'm new here. I have been taking some programming courses at my college and for my one class a semester ago I wrote a short demo RPG that is essentially a recreation of a battle in Phantasy Star 4. It's written in Java and I would basically like some feedback on how I did some things for example, whats good, whats bad, how it could be done better, etc. All my teachers pretty much praised me for it but I have a feeling a lot of it wasn't really done in a good way. For example to do Animations I used threads for each animation because that was the only way I could find to do Animation in Java.
Anyways, if some of you don't mind, if I post the code here would you mind looking at how I did things in it and giving me some feedback?

Share this post

Link to post

Share on other sites

For character and boss data:Each character has it's own class which defines it's stats and what skills it has and the calculations for what those skills do. The classes also determine how they are healed, how they die, how they are revived, etc.

For the Battle part:The battle side of the game is in the GamePanel class. I used the basic GUI functions in java.swing and java.awt to do the graphics. Basically what is done is frames of animation are stored in arrays. These arrays are then used when that animation thread is called, which cycles through the array to display the animation. Each animation has it's own specific thread. The graphics themselves are stored in JLabels which are then added to a JLayeredPane. Buttons and JComboboxes are used to select attacks, when the confirm button is clicked the Battle Sequence function is called which is essentially a bunch of if/else statements which depending on what actions are selected, calls the specific animation and the damage calculations for those actions. When all this is done the game checks to see if there is a win or loss.

For the Map part:This was done by keeping the character sprite in a fixed position on the screen, with one giant map picture as the background, when a direction is pressed, the character animates, but the actual movement done is the map behind the character to give the illusion of movement. When a specific point is reached on the map, the battle is initiated and the game kills the Map JFrame and creates the battle JFrame. Collision Detection is done by using coordinates and saying "If the character reaches these coordinates, turn back." I know it's not realy collision detection, but I couldn't think of a better name for it.

Here is the source code for those interested:http://www.megaupload.com/?d=IB1ASCXF