I created a JApplet game for a class project. My game is basically a dodge-ball game. I have 5 dodgeballs bouncing around the screen with a player starting in the middle. The object is to mouse drag the player dodging all of the balls bouncing.

The problem I am having is the dodge-balls pass right through my player. I want the game to end if the player gets hit. I am having difficulty setting this up and was wondering what exactly do i need to be using. I believe it has something to do with mouse listener but am not sure. If someone could help point me in the right direction would be much appreciated.

Thanks

Recommended Answers

All 2 Replies

Since you are dragging the player with the mouse, have you tried making a mouseover event for the balls?

I am a little confused with the mouseover event I can't really find anything on it. What i was thinking of trying but am unsure if it will work is setting to check for collision and if it collides just do like a joptiondialog box pop up letting them know game over. Any idea if this would work? Would try this on my program but currently at work and can't work on it :p. just curious if it is something that might work if anyone knows.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.