Click here to Skip to main content
15,917,062 members
Home / Discussions / C#
   

C#

 
QuestionMaths for bouncing a ball around a window.. Pin
Kevin Bewley8-Jul-13 4:42
Kevin Bewley8-Jul-13 4:42 
Hi all

I'm playing around with threading at the moment (self-directed learning) and what I would like to do is bounce balls around in a windows each with a thread of their own. I know this might not be the BEST way to do this, I want to do it purely for the learning.

My idea is that I'll have a ball object that will be updated by a timer Event. At regular intervals, on a separate thread, I'll get the positions off all my balls and Draw them to the window. I will probably attempt to get some collision detection between balls going eventually but for now, they'll just bounce if they hit the sides/top of the window.

Anyway, what I really would like to do is have the balls move around with fairly good physics. ie. gravity. But, my maths although good is inappropriate (I did maths & statistics at A level for my current career in biology). So, what equations can I use to give me x and y coordinates when I plug in an increasing value for time(t)? I realise I'll need to check if for x+radius>=rightWallX and x-radius<=leftWallX etc. it's just the movement in the presence of gravity I need.

Can anyone help me out with the maths? I did try google but I think I'm failing to provide the 'right' search terms to find what I want.
AnswerRe: Maths for bouncing a ball around a window.. Pin
NickPace8-Jul-13 5:10
NickPace8-Jul-13 5:10 
GeneralRe: Maths for bouncing a ball around a window.. Pin
Kevin Bewley8-Jul-13 5:19
Kevin Bewley8-Jul-13 5:19 
GeneralRe: Maths for bouncing a ball around a window.. Pin
NickPace8-Jul-13 5:25
NickPace8-Jul-13 5:25 
GeneralRe: Maths for bouncing a ball around a window.. Pin
Kevin Bewley8-Jul-13 5:46
Kevin Bewley8-Jul-13 5:46 
GeneralRe: Maths for bouncing a ball around a window.. Pin
harold aptroot8-Jul-13 6:00
harold aptroot8-Jul-13 6:00 
AnswerRe: Maths for bouncing a ball around a window.. Pin
Keld Ølykke8-Jul-13 20:11
Keld Ølykke8-Jul-13 20:11 
QuestionWebException timeout Problem. Pin
vishalmudrale8-Jul-13 4:04
vishalmudrale8-Jul-13 4:04 
QuestionRe: WebException timeout Problem. Pin
Eddy Vluggen8-Jul-13 4:59
professionalEddy Vluggen8-Jul-13 4:59 
AnswerRe: WebException timeout Problem. Pin
vishalmudrale8-Jul-13 20:20
vishalmudrale8-Jul-13 20:20 
QuestionRe: WebException timeout Problem. Pin
vishalmudrale8-Jul-13 20:21
vishalmudrale8-Jul-13 20:21 
AnswerRe: WebException timeout Problem. Pin
Eddy Vluggen9-Jul-13 0:22
professionalEddy Vluggen9-Jul-13 0:22 
GeneralRe: WebException timeout Problem. Pin
vishalmudrale9-Jul-13 0:40
vishalmudrale9-Jul-13 0:40 
GeneralRe: WebException timeout Problem. Pin
Eddy Vluggen9-Jul-13 3:03
professionalEddy Vluggen9-Jul-13 3:03 
QuestionDeveloping a Point of Sale System for Reataurant/Hotel Pin
MohdWaseem8-Jul-13 3:46
MohdWaseem8-Jul-13 3:46 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Manfred Rudolf Bihy8-Jul-13 4:46
professionalManfred Rudolf Bihy8-Jul-13 4:46 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Dave Kreskowiak8-Jul-13 5:18
mveDave Kreskowiak8-Jul-13 5:18 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Walt Dexter8-Jul-13 7:21
Walt Dexter8-Jul-13 7:21 
AnswerRe: Developing a Point of Sale System for Reataurant/Hotel Pin
Bernhard Hiller8-Jul-13 23:12
Bernhard Hiller8-Jul-13 23:12 
QuestionMessage Closed Pin
7-Jul-13 11:28
User34907-Jul-13 11:28 
AnswerRe: double.tryparse() Pin
Garth J Lancaster7-Jul-13 12:33
professionalGarth J Lancaster7-Jul-13 12:33 
AnswerRe: double.tryparse() PinPopular
Mycroft Holmes7-Jul-13 13:06
professionalMycroft Holmes7-Jul-13 13:06 
QuestionC# Pin
Manish Kumar1234567-Jul-13 9:56
Manish Kumar1234567-Jul-13 9:56 
AnswerRe: C# Pin
Pete O'Hanlon7-Jul-13 10:45
mvePete O'Hanlon7-Jul-13 10:45 
AnswerRe: C# Pin
Jay Nardev7-Jul-13 20:18
Jay Nardev7-Jul-13 20:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.