Pongggg help
Author |
Message |
mil55
|
Posted: Sun Mar 05, 2006 2:20 pm Post subject: Pongggg help |
|
|
hey ppl here's the problem im makin a pong game ryte buhhh... how do i make the ball so that when it hits the pedal it bouncez bak..... any help u can giv will be appericiated aite b ez. peaZe |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
cool dude

|
Posted: Sun Mar 05, 2006 3:31 pm Post subject: (No subject) |
|
|
first of all please refrain from double posting.
for your problem u can either use watdotcolour to determine if ball touched the colour of the paddle. (check it up in turing tutorials or help menu in turing) or just use the x and y coordinates and say that if the ball x coordinate is > than the paddle x coordinate than direction of ball = *-1 and the same thing for the y coordinate. |
|
|
|
|
 |
Delos

|
Posted: Sun Mar 05, 2006 3:36 pm Post subject: (No subject) |
|
|
Hello.
1) Please do not double post a thread. It was probably just a mistake this time, but in future keep this in mind. (Your other thread has been deleted).
2) Please use conventions when posting questions. For instance, read the Rules. It will make getting help a lot easier.
3) General heuristic related to 2): when asking a question, unless you have a very good reason to do otherwise, post up some code using [code] tags.
Unless the code is very easy to read and understand, ensure that it will run as it stands.
Do not post up huge amounts of code, just snippets parsed to run without editting.
If you must, attach a .zip/.rar file containing the code and necassary external files (images, etc).
As for your question:
How much do you know about vectors when it comes to Physics? Use the concept that a ball has an x- and y- component in position and velocity. Thus a ball moving directly up will have no x-velocity, but positive y-velocity.
When the ball collides with the paddle, simply invert the required velocity for it to change directions. This method assumes conservation of momentum, so if your incident angle is, say, 15 degrees, your resultant angle will also be 15 degrees. |
|
|
|
|
 |
batman
|
Posted: Sun Mar 05, 2006 5:42 pm Post subject: Pong Help |
|
|
Please do not use the word help in your title.  |
|
|
|
|
 |
Delos

|
Posted: Sun Mar 05, 2006 5:50 pm Post subject: Re: Pong Help |
|
|
batman wrote: Please do not use the word help in your title. 
Sorry batman, gonna have to call you on that one. There is no rule saying "don't use the word 'help'". It is a little redundant, seeing as this is a Help Forum, but no rule against it.
The rule that does exist, however, is not to entitle threads to the effect of "I need help", or "help me", or "omg, i pay u if u help!", or...well, you get the idea. |
|
|
|
|
 |
Reality Check
|
Posted: Tue Mar 07, 2006 5:40 pm Post subject: (No subject) |
|
|
Well, you could use the colour so that it detects the colour of the paddle OR you could have it inverse when it hits the certain coordinate the paddle is on. |
|
|
|
|
 |
cool dude

|
Posted: Tue Mar 07, 2006 9:08 pm Post subject: (No subject) |
|
|
Reality Check wrote: Well, you could use the colour so that it detects the colour of the paddle OR you could have it inverse when it hits the certain coordinate the paddle is on.
i said the exact same thing! |
|
|
|
|
 |
|
|