Doodle Jump for PC

No. As I said, other applets using the same keys work just fine. Maybe the KeyListener and the MouseListener are not on the same component.

The KeyListener and MouseListener are on JApplet’s ContentPane.

Ok here is how it works. I have 2 components, one for the Menus, one for the GameWorld. When you click play, I remove the Menus component and add the GameWorld component. The KeyListener and MouseListener objects are, however, added directly onto the JApplet, not on either component.

Just tried it. Fun! Good sf/x too. I liked discovering what the different objects do. No bugs or problems to report, that I came across. Nicely done!

So, this is a copy of a game on a hand-held? Copying is a good way to learn. I hope your plans include ambitions for designing and writing your own, too.

Thx!

Thanks!
What does sf/x mean :stuck_out_tongue:
And this was my first ever game so I wanted to test my graphics and designing abilities!

Sound effects :slight_smile:

Mike

Thanks, I didn’t know that abbreviation.

Also, I have included a link to the source code. Check out the first post of this thread :smiley:

gouessej, is there something wrong with the listeners in Java?
Putting the Key and MouseListeners on:
-the component that draws the game does not work,
-the GlassPane does not work,
-the RootPane does not work,
-(out of desperation) the JLayeredPane does not work

Only the content pane works for me and the majority of people playing this game.

Is there an inconsistency with different version of Java and/or the operating system they’re installed on?

By the way, I just noticed the Featured Games section :stuck_out_tongue:

Could you guys rate my game? Thanks! :slight_smile:

Same problem as gouessej.

Clicking the mouse works but the keys don’t. MacBook Pro, java 1.6.0_22, running in Safari.

Try updating java, latest version is release 24

Both of you are using Macs. So it must be a problem with Listeners with Java for Mac since the keys work on all Windows and Linux computers.

Write once, run everywhere huh? ;D

No not only on macs … on my pcs with Windows Vista and Windows 7 same problem … tested with release 24 and Java 7 running firefox.

I did some testing the other day with a very basic applet and was able to get it (using KeyListener) working on my system within Safari. I also tried downloading your source code and modifying it in a few different ways but no luck. I managed to get JDoodleJump to run fine on my system when launched directly from my IDE but it still did not work when running it from Safari (the keys still didn’t work).

I think the problem has something to do with slight differences across OS/browser/JRE combinations in how focus is handled.

to allow keyboard input into buggy java version on Mac. (64bit using Chrome) with my own applets I had to click in the address bar then click back on the applet

JDoodleJump works in Safari, Internet Explorer, Firefox, and Chrome on my Windows 7 x64 box and my parent’s Windows XP.

What is weird is how, like Apo said, it doesn’t work on Firefox, Windows 7 when it works on mine. That doesn’t help me try to narrow down the problem :confused:

I’m going to give a deeper look at your source code, I should be able to fix this bug.

Edit.: Please can you use Applet instead of JApplet? Is Swing mandatory?

Edit.: strange… the mouse adapter is not added on the same component than the key listener, I was right:

gw.addMouseListener(new MouseAdapter() {
addKeyListener(new KeyAdapter() {

Edit.2: I was right, you were wrong. The key listener in on a GameWorld that extends JComponent whereas the mouse adapter is on the content pane.

Fun little game. Good work.

Firefox 4 beta 12
Windows Vista

Agh was that in the public source code? That must have been the wrong version then since in the current game on my website, both listeners are added to the content pane.

And I really don’t see a difference between Applet and JApplet other than that JApplet supports Swing.
What is the advantage of using Applet?

Thanks!

Yes.

Maybe try to put them both onto the GameWorld instance.

Use Swing only if it is required. If you don’t need Swing, you don’t need to use a JApplet. Applet is generally a bit more reliable than JApplet.