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 / Specter's Useful Tutorials

Author
Message
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 16th Nov 2005 01:11 Edited at: 17th Nov 2005 06:58
Here's is an assortment of tutorials I thought about writing to help out beginners to Dark Basic.


If... Then....:
Another huge part of games is AI code or engines. In a nutshell, if one thing happens, iniate another thing.

Example:
If myscore = 500 then goto next_level:.

If Then statements are easiest to use.

gosub enemies_sight
If enemy_sees_you then gosub enemy_fire

You are most likely going to use if then statements for any syntax you will ever make.

Logical Operators:
As you may know in all games being released, a line of code (or several depending on what language) are used to have something happen. Below is a sample list.

= Equal to
<> Not Equal to
< Less Than
> Greater Than
<= Less Than or Equal to
>= Greater Than or Equal to

If myscore = 500 then goto you_win:.
If mytimer = 0 and myscore=0 then goto you_lose:.

An excellent example of timer tutorials is TDK's that is stickied on the top of this board.
An excellent example of a game with a timer is "Mario Bros."

Do Loops:
The main part of a program would be the main loop. To create a main loop, you would make the code:
Do

Loop

Every code inside that do loop will keep occuring over and over.
If you were to type:
do
print "Hello World"
loop
you would find a LONG list of Hello World on the left of your screen.
Why?
Because that code starts with the do and after it does the command, it hits the word loop. Loop tells it to go back to the do.
If you did not want this to happen, you would type in the command:
set cursor 0,0
That would place the text, or anything, and the top left hand corner of you screen. Of course, you would type
do
set cursor 0,0
Print "Hello World"
loop
for that to happen.

Creating Objects:
Every game you have played and will play will always have an object in it. It can be a basic crate or Master Chief. The most basic command to create objects is below:

make object cube 1,100

That would tell the program to create a cube, with the diminsions of 100. 100 high, 100 wide, etc...
For our basic syntax, you would add in the command:
make object cube 1,100
do
set cursor 0,0
print "Hello World"
loop
Never ever ever ever ever place the command "make object cube 1,100" inside your do loop. Try it now and see what happens.
Exactly, it already exists. You are telling your program to read the code in you do loop, but it goes back to the to and it says to make another object. In "make object cube "1",100" the "1" is the ID number of your code. This is helpful for organising your objects with numbers.

Cameras:
One of my favorite things to deal with is Cameras. Cameras obviously view your objects and your game world.

The basic commands for using cameras are below:
position camera (position, position, position)
point camera (position, position, position)

That is easy to use for positioning where you want your camera.


MORE UPDATES SOON
Lastly, if you didn't find this useful, sorry for wasting your time.


EDIT:
These work for DBC. I haven't tried DBP, they should though.

Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 17th Nov 2005 01:16
Very Nice!!!!!!!!

Just make it a bit more readable!

You Don't know the power of the Dark Side!!
Oh but I do!!
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 17th Nov 2005 01:42 Edited at: 17th Nov 2005 01:46
Its a much better start than some of the people have been doing around here... But the downside is the help files with DB offer more information on the commands than you have, which when you think about it eliminates the point of writing the tutorial.

For example, your camera controls, you listed 2 commands whereas there are many more camera controls, and yes I realize you're listing the basics but would you not concider TURN CAMERA, PITCH CAMERA, ROLL CAMERA, MOVE CAMERA all basic camera commands aswell?

Also you give fairly vague information on the comands, basically you've explained the common sense part and left out the needed details.

I'm not trying to put you down, just constrctive critisism; with a little more work it could become a good beginning tutorial for newcommers.

Goodluck

<EDIT>

Noticed something else;

Quote: "Never ever ever ever ever place the command "make object cube 1,100" inside your do loop. Try it now and see what happens."


This is wrong, I understand what you're trying to say but what comes across is that you're saying you should never, no matter what the circumstances, use this command in the loop. You're speeking from personal experience here I can see, I'm sorry to say it isn't true. What if the user wanted to delete a box when the user pressed one button, and then make that box when the user pressed another button? You would most likely need a MAKE OBJECT command in the loop, this is just a very basic example, there are many cases I have used these commands in loops, it just involves some checks to make sure the object doesn't exist so a runtime error doesn't occur.

DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 17th Nov 2005 06:54
@ Ruccas, you have made some valid points, sorry for not considering all possible explanations.

@ Darth Vader, I'm makin em readable right now.

Lol I changed my name from Specter to Drew G again

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 18th Nov 2005 23:46
Nice tutorials... I wish more people would read mine...
OrTiz
User Banned
Posted: 3rd Dec 2005 05:04
very nice mija
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 7th Dec 2005 05:13
Ortiz!?!
What the (explicit deleting) are you doing here. You don't even use Dark Basic that much. Nevermind, maybe a noob like you will use these.

Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 7th Dec 2005 13:50
nice work, Drew G. i must confess i lurned a thing or two that will realy help me, so thanks.

Thebeely
19
Years of Service
User Offline
Joined: 4th May 2005
Location: Croatia
Posted: 7th Dec 2005 15:56
Quote: "What if the user wanted to delete a box when the user pressed one button, and then make that box when the user pressed another button?"


Erm... Maybe hide object/show object commands? But It's not true that you may NEVER use "make object" command in your main loop...

Thebeely team...
Great software...
Join us!
DrewG
19
Years of Service
User Offline
Joined: 25th Aug 2005
Location:
Posted: 7th Dec 2005 22:54
@ Thebeely
Since the target audience I targeted here is for newcomers, I put that. You are current, if a delete object command was placed at the end of the loop, then you do have a valid point. However, if a newcomer is probably that far yet to put a make object command a delete object command in his/her game or program. Some are, but some aren't. That is why I posted that. I should of clarified.

Your signature has been erased by indi, because he is a hater of the Anti ANJL.
OrTiz
User Banned
Posted: 6th Jan 2006 22:56
how do you load animations??

Login to post a reply

Server time is: 2024-09-24 11:27:57
Your offset time is: 2024-09-24 11:27:57