6 Replies - 3266 Views - Last Post: 01 June 2009 - 08:35 PM Rate Topic: -----

#1 Q8y  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 54
  • Joined: 06-April 09

how to stop bouncing ball ?

Posted 01 June 2009 - 07:33 AM

Hi

I have a HW is to create bouncing ball that moves(diagonal) and when i click to it, the ball should stop...

my problem is how to stop the moving ball ???

The code I'm afraid to put it online(here) because it's HW and maybe some one take my HW and submit it... So, if any one can help me with it, i can send my code to it to figure the problem...

please guys i really need your help..

thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: how to stop bouncing ball ?

#2 gl3thr0  Icon User is offline

  • D.I.C Regular

Reputation: 19
  • View blog
  • Posts: 319
  • Joined: 27-October 07

Re: how to stop bouncing ball ?

Posted 01 June 2009 - 07:36 AM

why would some copy it.. it does not work yet...

post the code and you will get a lot more help
Was This Post Helpful? 0
  • +
  • -

#3 NeoTifa  Icon User is offline

  • Whorediot
  • member icon





Reputation: 2776
  • View blog
  • Posts: 15,878
  • Joined: 24-September 08

Re: how to stop bouncing ball ?

Posted 01 June 2009 - 07:39 AM

How do you stop a bouncing ball? Catch it. :\ :P

Try stopping or pausign the thread thats controlling the ball.
Was This Post Helpful? 0
  • +
  • -

#4 Q8y  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 54
  • Joined: 06-April 09

Re: how to stop bouncing ball ?

Posted 01 June 2009 - 07:46 AM

View Postgl3thr0, on 1 Jun, 2009 - 06:36 AM, said:

why would some copy it.. it does not work yet...

post the code and you will get a lot more help



No, it does work.... the Hw have many parts in it...

the main thing is to create a bouncing ball and move in diagonal ... and there is a zone that when a ball is entering it , it should check if there is some one else there or not.. if there are they should wait...

and all of these thing i did finish from it... all thing that i need is to stop the ball when i click on it...

and there is another parts, but i want to finish from this part and then continue to the other parts if i have times...


So, for that reason i can't post it online...


i will send it to you "gl3thr0"...

i hope you can help me in it... & check ur mail

thanks
Was This Post Helpful? 0
  • +
  • -

#5 computerfox  Icon User is offline

  • straight vegetarian kid

Reputation: 50
  • View blog
  • Posts: 3,772
  • Joined: 29-January 09

Re: how to stop bouncing ball ?

Posted 01 June 2009 - 08:04 AM

you should have an if statement that would stop it and if you wanted to start it up again you would use another if statement. hope that helps :)
Was This Post Helpful? 0
  • +
  • -

#6 Q8y  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 54
  • Joined: 06-April 09

Re: how to stop bouncing ball ?

Posted 01 June 2009 - 08:11 AM

View Postcomputerfox, on 1 Jun, 2009 - 07:04 AM, said:

you should have an if statement that would stop it and if you wanted to start it up again you would use another if statement. hope that helps :)



I know that, but it's not that easy.. Since i have many ball and many thread, how can i stop any one of them...!!! ?

Can i Pm u the code???

thanks
Was This Post Helpful? 0
  • +
  • -

#7 virgul  Icon User is offline

  • D.I.C Regular

Reputation: 44
  • View blog
  • Posts: 269
  • Joined: 18-March 09

Re: how to stop bouncing ball ?

Posted 01 June 2009 - 08:35 PM

does the ball itself have a thread though. If so you can just stop that thread upon mouse click. you said that you already many threads, so to the thread with the ball just add a mouse Listener. and when an action is done you can have a boolean saying weather the ball is moving or not, and do what you need to do

if(moving)
	ballThread.stop();
if(!moving)
	ballThread.start();


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1