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.

Newcomers DBPro Corner / how come the ball isn't rotating properly? (pong game)

Author
Message
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 10th Aug 2006 13:59 Edited at: 10th Aug 2006 14:15
Ok, so i haven't written a pong game before and i figured why not, it seems rather easy. but it definetly isn't easy.

my pseudo looks allright, and the code should work in my opinion, but db have other plans.

i've been sitting with this for an hour now, tried different methods like if ball.y < 5 then ball.direction = wrapvalue( ball.direction *-1 ) or if ball.y < 5 then ball.direction = wrapvalue( ball.direction -180 ) or if ball.y < 5 then ball.direction = wrapvalue( ball.direction +180 ) etc.

so if anybody knows what is wrong with the code, please let me know!


(no media is required)

edit,
it's the collision with the top and bottom walls that i am trying to figure out (line 64 - 67)


edit2,
ok i think i figured it out now. the problem was i had to call makeMedia() AFTER i setup the types and globals. hmm if i only knew that sooner. wasted thread. sorry to interupt your daily browsing.

Login to post a reply

Server time is: 2024-09-25 05:28:33
Your offset time is: 2024-09-25 05:28:33