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.

DarkBASIC Discussion / Ball Movement (Pong etc)

Author
Message
freestyler
21
Years of Service
User Offline
Joined: 16th Dec 2002
Location:
Posted: 15th Jan 2003 02:42
Hi all, I am a n00b at DarkBASIC and was wondering how complicated is setting up the ball movement like in the classic Pong?

I mean when the ball hits a wall or you (a bar at the bottom or something similar) how do you make the ball bounce off in the right direction.

ADVANCED - {not important :yet:}
Also how would you make the ball bounce in different directions eg, If the user controlled bar at the side/bottom collides with the ball while moving fast along the side/top how could you make the ball react differently to moving slower

(hmmm explained well? hmm

Thanks !
Dark Gamer
21
Years of Service
User Offline
Joined: 22nd Jan 2003
Location: United States
Posted: 22nd Jan 2003 07:38
Its not that hard, for example, to make it bounce off a wall:


This is just the walls though, you need to change it if you want to put paddles.

Hey look, it's Barney over th-BANG!!! Nevermind...
freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 22nd Jan 2003 13:58
the ball has to rebound in an angle equal to the angle between the ball path and the block
quite difficult for me to explain this in good english, so here's a drawing to explain it:


.
.
\
\ O
\ /
\ /
a \/ b
'''''''''''''
'''''''''''''

angle a = angle b

freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 22nd Jan 2003 14:02
ow some problem with this forum, it seems that if there's more than one space, it changes back into one space
an option that's intended good but isn't very practical

so I just placed points instead of spaces... I hope it's better now

....................
..*.................
...*................
....\...............
.....\......O.......
......\..../........
.......\../.........
......a.\/.b........
...'''''''''''''....
...'''''''''''''....
....................

angle a = angle b

freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 22nd Jan 2003 14:03
it's not completely what I expected but it's better than nothing

the "O" is the ball
the "\" and "/" and "*" stand for the path of the ball
the "'" is the block on which the ball rebounds

Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 22nd Jan 2003 14:08
Actually that's HTML for you (rendering multiple spaces as 1) if you want to retain formatting then use a code tag.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
freak
21
Years of Service
User Offline
Joined: 20th Jan 2003
Location:
Posted: 22nd Jan 2003 14:26
thanks for the hint!
...I'm quite new to this forum, I didn't know

It's a pity it isn't possible to edit a post..

Dark Gamer
21
Years of Service
User Offline
Joined: 22nd Jan 2003
Location: United States
Posted: 23rd Jan 2003 04:01
hmmm... ok then, how about this?

Hope it helps!

Hey look, it's Barney over th-BANG!!! Nevermind...

Login to post a reply

Server time is: 2024-05-05 07:16:23
Your offset time is: 2024-05-05 07:16:23