Some help with an RPG im working on :)

I have a lot of questions and am in need of a lot of help, so I thank anyone who helps in advance for their kind efforts :slight_smile:

The game itself is here: http://www.paraduck.net/misterbob/gameBeta/

Theres walking around, a representation of the menu, and a random battle system. Note that no monster appears yet in the battles as I have no graphics at the moment :stuck_out_tongue:

The level editor (very early version) is here:
http://www.paraduck.net/misterbob/java/

Ok, now for the questions :slight_smile:

Youll notice if you hold a directional key in the game, the character sometimes jumps around. Is there any way to stop/control this? I’m using the built in keyDown(Event e, int key) method if anyone needs to know that :stuck_out_tongue:

Secondly…is there a better way to use Timers than thread.sleeps? In the battle system youll sometimes notice the text displays LONG before it should.

Next, is there any better way to store levels than the way I’m doing it? (Go to the level editor, and click the button that generates the code output).

Also, how do i force images to load at the start of the applet? This can become an issue on some occasions…

Lastly, any suggestions or improvements recommended?

Thanks a ton :slight_smile:

Oh, I almost forgot…Is there any way to save data without having a “signed” applet :-X

“Youll notice if you hold a directional key in the game, the character sometimes jumps around. Is there any way to stop/control this? I’m using the built in keyDown(Event e, int key) method if anyone needs to know that”

Implement a thread that moves the character based on a timer if the “move” key is currently pressed. Track the key pressed using keyPressed and keyReleased.

“Secondly…is there a better way to use Timers than thread.sleeps? In the battle system youll sometimes notice the text displays LONG before it should.”

Not sure really, I don’t have timers like since I need a constant game loop.

"Next, is there any better way to store levels than the way I’m doing it? (Go to the level editor, and click the button that generates the code output). "

Pretty much any way would be nicer ;). A raw data file would be a first shot, you could go XML but there are quite a few overheads with large data sets.

“Also, how do i force images to load at the start of the applet? This can become an issue on some occasions…”

Introduce a class that loads all your images at initialisation and use a java.awt.MediaTracker to wait for them to load.

HTH

Kev

[quote]Youll notice if you hold a directional key in the game, the character sometimes jumps around. Is there any way to stop/control this? I’m using the built in keyDown(Event e, int key) method if anyone needs to know that
[/quote]
are you actually moving your character from within this method? that would explain why it’s doing that. what i do is have the keyPressed and keyReleased methods change boolean values in the main class. that way you’re not tying up the awt/swing threads doing animation work. the main game loop checks whether the key is down and handles the movement.

Um, didn’t I just say that?

Incidently, “How do I become a full member?”, are you still without an answer? I believe there a different levels of membership dependant on the number of posts you’ve made. What these levels are, who knows? Probably, SG.

Kev

Junior Member - < 100 posts
Full Member - > 100 posts
Senior Member > 250 posts
god member - > 500 posts
???

[quote]Um, didn’t I just say that?
[/quote]
Not really. You told him to implement a new thread, which I disagree with. I see no reason to implement a seperate thread to update game state. As JuddMan suggested, switching a boolean flag on key presses would be synchronous and less prone to error.

I just didn’t assume that he has a central game loop. The point is that the updates should be done in a different thread (even it happens to be the main thread), as in not the AWT event thread.

The boolean flag was what I was getting at with:

Incidently, even if you have a main game loop in a few cases a seperate thread is far more elegant.

Kev

Thanks, i added a key event listener and it fixed it nicely.

However i think I am going to port this to a full screen java game, as i really need save capabilities…passwords would be very annoying :stuck_out_tongue:

Also as a full screen game i can just load the levels from the level editor as files…