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 / Pong Game

Author
Message
Cookyzue
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Who Cares?!
Posted: 10th Nov 2003 01:05 Edited at: 10th Nov 2003 01:13
im trying to make pong and all i can do is make the ball go back and forth.how can i make it bounce off the top and bottom walls?
heres the code
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 10th Nov 2003 01:07
why did you put the code in the message AND the source? i would suggest to remove it from the message, it takes to much scrolling

Two words, moo.
Cookyzue
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: Who Cares?!
Posted: 10th Nov 2003 01:10
ive never put in codes before and i wasnt sure which one to use.Sorry!
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 10th Nov 2003 01:11
its cool. use the Edit Post under your name avatar and such to remove it.

Two words, moo.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 10th Nov 2003 08:38 Edited at: 10th Nov 2003 08:41
@Cookyzue:

To Creatively Critisize;
Ok... i just had a look through your code, and, I don't mean to be rude, but it really lacks any structure or convention and is not very well set out in terms of commands used...

To help;
With your code, use some sort of common way to write it, don't relly on the syntax highlighting abilities of DarkEDIT to be able to distingush your code from comment etc.
For example, whenever i code, i use CAPS for the first letter of every word that is a command like Make Matrix or EndIf or Screen Width()...

When setting out your code, try to modulate it as much as possible, ie use lots of functions, or gosubs, don't rely on Goto's, they are a programer's worst enemy and are only in DB for old-school programers to use...

And i also noticed that you have a Do...Loop nested inside of another Do...Loop when all is needed really is a sub or a function...


I know I haven't helped with your code, but in a few months when your making your "big project" you'll be thinking "Wow, JessTicular really was onto something there... I wish i had of set out my code neater so i could understand what's going on right now..."

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Dark Coyote
21
Years of Service
User Offline
Joined: 17th Oct 2003
Location:
Posted: 10th Nov 2003 16:18
Sort of a side question here: Why does everyone hate gotos?

As for laying out work, I always put big comments at the top of sections like:

Rem ------------- LOAD OBJECTS ----------

It helps me locate an area of code quickly when i need to change/add something.

Dark Coyote.
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 10th Nov 2003 17:23 Edited at: 10th Nov 2003 17:30
another thing I like to use is Labels.
Place a label near any "important" thing and you can quickly
locate that spot again using

DarkEdit Labels list tool
DBPro IDE label list

How to bounce off top/bottom - your Q?
well, test for it and change DY to 0-DY
assuming your using DY for rate of virtical movement...

Then position sprite where there is not a colision

then continue game...

should be rather straight forward I think....

internet gaming group

Login to post a reply

Server time is: 2025-05-21 16:16:23
Your offset time is: 2025-05-21 16:16:23