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 / cant get pong ball to go different directiosn

Author
Message
Great Knight
21
Years of Service
User Offline
Joined: 25th Feb 2003
Location:
Posted: 22nd Apr 2003 02:51
I made a pong game but when i try to make my ball go different directions it does not listen to me and it goes side ways crazy. And for some reason the border does not go across the screen like i want it to. Can someone help me with the code for the ball. I cant seem to get my ball to work right. Thanks.
DBPRO only

AMD Atherlon 2400+ XP, 380 DDr memeory, ATI Radeon 9000 64 DDR.

And a Katana.
Cras
21
Years of Service
User Offline
Joined: 15th Oct 2002
Location: United Kingdom
Posted: 22nd Apr 2003 03:10
well ive never tried a pong but i had an idea. make the paddle length divisible by 180 because it will make it easier. when the ball hits the paddle, mirror it. now take the location it hit it (its position compared to the paddle position can be used to work this out) then depending on where it hit increase the angle, keep it the same, or decrease it. by using 180 u can make every 10 units or remove 10 degrees. or 10/something cos 90 degrees might make it carry on backwards. experiment. u cant just make it mirror of it cos that will mean the ball moves the same way all the time.
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 22nd Apr 2003 03:15 Edited at: 22nd Apr 2003 03:16
One way is to multiply the speed of the ball by -1. That will make it reverse without changing speed.

Like this:


All programmers are playwrights and all computers are lousy actors." -Anon.
Cras
21
Years of Service
User Offline
Joined: 15th Oct 2002
Location: United Kingdom
Posted: 22nd Apr 2003 03:31
teehee would go back in the same direction it came. i once made a silly football game which i never released here (deleted now) but that had the ball bouncing off a few things and that was my 1st thought, but u cant take the easy way. u get the angle udsing trig then subtract it from 360 and thats the mirrored angle.
Grunta
21
Years of Service
User Offline
Joined: 20th Apr 2003
Location:
Posted: 22nd Apr 2003 06:34
I'm dissappointed.

I tried to start a thread to discuss whether to get Darkbasic pro or Blitzbasic, a genuine open discussion, but had my thread locked as it is not policy to discuss these things? The blitz forums are quite happy and very helpful and we discussed it quite freely (with interesting results). What have darkbasic got to hide? Why not discuss it?

I am tending towards Blitzbasic3d now as the forums are extremely helpful.

cheers

Cras
21
Years of Service
User Offline
Joined: 15th Oct 2002
Location: United Kingdom
Posted: 22nd Apr 2003 13:22
grunta, ill be more than happy to tell you my oppinion. i have no 1st hand knowledge of blitzbasic although i occasionally look at the site to see whats being made.
i think:
- darkbasic is perfect for programming as a hobby
- darkbasic is well priced and is worth every penny
- it is easy to make projects within days of darkbasic and unlike somethings, there is no limit to what u can create so they better you get the better your programs get.
- the forums here are both amusing and helpful which is a god mix when u are stressed during programming. they would avoid your topic because people could just start flaming blitzbasic and then people could argue.

my advice is to go for darkbasic, you can get help and you may surprise yourself and not need it that often. also you can easily find teams and there are loadsa competitions and the newsletter is very good.
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 22nd Apr 2003 20:38
great knight, andrew11 is spot on - its very simple, just reverse the relevent velocity.
I posted an example of a ball bouncing around inside a cube - all i do is reverse the releven velocity when it hits a wall.

Login to post a reply

Server time is: 2024-09-20 06:26:06
Your offset time is: 2024-09-20 06:26:06