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 / I'm gonna make pong, help needed

Author
Message
Lem142
21
Years of Service
User Offline
Joined: 29th Dec 2002
Location:
Posted: 29th Dec 2002 20:07
Hi guys, I'm new to the forums and I would like to say hello! Well, first i decided that I will start small by making pong. The thing is I barely know anything about programming. I know some basics, but not enough to make pong. I don't want to read tutorials that just give loads of info about programming because I don't learn well that way. Instead, can u guys post coding and explain each line? Also, can you guys explain what y-xpos and x-xpos are?
Thanks!
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 29th Dec 2002 21:06
Well, I dont think many people will do this, because it sounds like you dont really care if you learn to program or not. You should read the tutorials, believe me they will help. How long have you been using DB anyways?

About your questions with the positions. The "code" you gave means ABSOLUTLY NOTHING. This is what you mean, probably.

Object Position Y(x)
Object Position X(x)

For the x's in the parenthesis, that is what the object number is. Full code would look like...



Now I will explain that.....

Line 1) This line simply loads the model, and assigns it the variable of 1. When telling the model what to do, you must always use its assigned variable. Models need to be in the same folder as your projects code.

Line 3) This line starts the main loop of the program. This keeps the program running. If the DO is not there, then the program will not run, instead, it will come up with a screen showing your object and saying that it has completed running the code with the prompt "Press F12 To return to the Editor"

Lines 4 & 5) These lines are telling the object IF a key is pressed THEN do the corresponding commands. This is called an IF THEN statement. So, IF the UPKEY is pressed THEN MOVE the OBJECT [1] a positive 10. As you can see here, the object is called by the 1 that we assigned to it earlier. The same commands go for the 5th line of code.

Lines 7 & 8) In these lines, we assign words to commands. This will simply keep our code shorter. Here I used xpos# and ypos#. The pound signs (#) are there to show this is a number value, and will be used later in the code. This is telling the system that when xpos# is mentioned, it is referring to the OBJECTS X POSITION. That is what the line of code means. It is literally saying... xpos# means the position of object 1 on the X axis. The same goes for the ypos# line. It translates the same way, just replacing X with Y.

Lines 10-12) Line 10 SETS THE CURSOR at 0,0. Since we are in a LOOP, the cursor needs to be set at one position, or else the words will go way down the screen over and over again. Lines 11 and 12 use our variables that we set earlier. The PRINT command tells the computer to PRINT the following words. Words are represented in "Quotes". Line 11 tells the computer to print, at 0,0, "The Objects X Position is ". This is then followed by a semi-colon ( which tells the computer to print the following information on the same line. the following information is the variable that we just set, xpos#. Going back earlier, this is telling the computer to print the object 1's x position. The same information goes for the 12th line, just with Y instead of X.

Line 13) This line is the LOOP statement. This concludes a DO LOOP statement. It closes the main loop. For every DO there must be a corresponding loop somewhere else in the code. There are always the same amount of Do's and Loop's.

Well, that pretty much sums up the OBJECT POSITION command. Now try and tell me that THAT tutorial wasnt useful. I wrote it for a complete noob, so it should be VERY easy to understand.

If you need anymore help, contact me on the instant messengers below. My MSN is TheBedroomProgrammer@hotmail.com, my sign in name is RPGamer.

Regards,
RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
Upcoming- MMOFPS- Paintball Game: HELP WANTED!
Http://halbrosproductions.netfirms.com

Login to post a reply

Server time is: 2024-11-23 19:43:30
Your offset time is: 2024-11-23 19:43:30