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 / My First Program - Problems

Author
Message
Barbarian
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location:
Posted: 15th Sep 2007 04:59 Edited at: 15th Sep 2007 05:00
Hey, i've decided to make 3D Pong as my first Dark GDK program, and i'm having some trouble.

Here's the code -



Anyway, the problem is, that some time through the game (pretty early, maybe after hitting the ball 10 times) the ball starts sticking to the edges and vibrating. If you compile the program, you'll see. I think the problem may have something to do with the "MoveBall", "CheckPosB" and "CheckPosT" functions, but it may not be. Anyway, all help will be appreciated, and just ignore all the warnings when compiling.
kBessa
17
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 15th Sep 2007 05:16
Ok, I had this problem while I was writing my first tutorial, I had this problem.

The things is that sometimes, it checks again before moving, so it is in the same position, and it changes the direction again.
You solve this by changing the direction only if it is moving to that direction, otherwise, it does not change the direction.

Ok, I don't if I explained right, but take a look at my tutorial, it is in DGDK.NET, but the logic is the same: http://www.thegamecreators.com/data/newsletter/newsletter_issue_54.html#5

Hope I could help

Thiago
Barbarian
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location:
Posted: 15th Sep 2007 05:19
thanks, i'm gonna try that as soon as i get back home
Barbarian
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location:
Posted: 15th Sep 2007 08:31
yay, i found the problem, i had:



when i should have had



The problem was that every time the ball was hit by a paddle it got faster (intentional) and it got to a speed where it went right out of the boundaries and the +1 or -1 back to the field didn't account for it. So, i just fixed it by replacing the +1 and -1 by +BallSpeed and -Ballspeed.
kBessa
17
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 15th Sep 2007 08:51 Edited at: 15th Sep 2007 08:51
Yep, that's another good solution also.
Glad you could come up with your own solution.

Anything else, just ask, plenty of people here will try to help!

Best regards,
Thiago
Barbarian
17
Years of Service
User Offline
Joined: 11th Dec 2006
Location:
Posted: 15th Sep 2007 09:21
thanks for the tutorial, i learnt a bit more from that too, even though it wasn't written as c++

Login to post a reply

Server time is: 2024-10-08 22:13:54
Your offset time is: 2024-10-08 22:13:54