Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Pong Help

Author
Message
JustMe
6
Years of Service
User Offline
Joined: 6th Dec 2012
Location:
Posted: 7th Dec 2012 01:18
I'm new here and i'm also new to programming. I am trying to make a Pong game on DarkGDK but my ball angles are giving me a hard time. Can anyone help?

Attachments

Login to view attachments
Hawkblood
9
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 7th Dec 2012 15:58
You can alternatively show code in your post. Makes it easier to look at instead of downloading it....

Now to your issue. The way you are doing your sprite is somewhat difficult to make it move in the proper direction. You can do it that way, it just takes more math. You need to determine the actual angle. I'm assuming your goals are at right and left of the screen. I don't remember if sprite angle 0 is up, but I'll assume it is for this example. If it's moving from left to right, it will roughly be at 90 degrees (we will say it's at 85 degrees). When it hits the paddle on the right, you will have to calculate the reflection angle.

You can add a paddle angle adder if the paddle is moving when it hits the ball. I think it will be simple for you to implement that code so I won't post it......

Hope this helps.

The fastest code is the code never written.

Login to post a reply

Server time is: 2019-09-17 09:32:18
Your offset time is: 2019-09-17 09:32:18