################################################################################
# Some Guy's All Out Newcomer Tutorial: The BASICs of DarkBASIC
# Skill Level: Just Started
#
# Chapters: 5
# If you liked this tutorial try: Some Guy's 2D Tutorial
#
################################################################################
Chapter 1: Da Basics
################################################################################
DarkBASIC is a programming language built upon Visual Basic. It uses the power of microsoft's
game engine Direct X. So let's get programming!
**Saying Hello World**
Let's jump into programming right away, this shouldn't be to hard for you to do. Hopefully not!
@@Source Code@@
Print "Hello World"
Run the example, not much really but a start no doubt.
**Variables**
Before you go any further we need to talk about variables, variables are used to store data.
variable# = 1.2
The top variable is called a real number, why? Because it is a decimal number as such.
Variable$ = "Hello World!"
This variable above yet again is a string$, because it stores words mostly. It can be used for
decimals or reals but they can not be treated as numbers only strings.
variable = 112
This variable above is a integer variable they can positive or negative.
**Saying Hello Again**
@@Source Code@@
hello$ = "Hello World!"
print hello$
num$ = "1"
numtwo$ = "2"
numthree$ = num$ + numtwo$
Print numthree$
num = 10
numtwo = -10.5
numthree = num + numtwo
print numthree
Run the code to see what happens
**Making Notes**
You may be wondering how we can make notes well that's easy! By commenting.
@@Source Code@@
Rem this is a comment rem is short for remark
` this is a easier way by pressing the ` key
Remstart
A GROUP OF COMMENTS
remend
Please run this code.
################################################################################
Chapter 2: Math
################################################################################
Unfornately if you hate math I brought it up, don't worry this is easy math, easy, easy, easy.
@@Source Code@@
Rem the Guessing Game
Rem A Easy Short Game
`Forgot the do and loop
do
num = rnd(100)
Input "I'm thinking of a number from 0 to 100 what is it? ",ynum
if ynum < num then print "Nope your wrong try higher."
if ynum > num then print "Too low!"
if ynum = num then print "You Got It!"
wait key
cls
loop
Ta-Da! Your first game. Try making a mad lib game or a name asker or continue on with math.
@@Source Code@@
Rem Adder
Rem A Easy Short Game
Input "What number should I add to another? ";numone
Input "And? ";numtwo
numthree = numone + numtwo
Print "This is the answer! ";numthree
Wow! Yet another game, try making one that subtracts, or divides, or multiplies
Oh and * is multiply, and / is divide in case your wondering
< is less, > is greater, <> is equal to, <= is less then or equal to, and >= is greater then or equal
to.
@@Source Code@@
Rem More Math
Rem A Simple Game
Input "Enter A Number";number
option = rnd(1)
if option = 1
inc number
print number
endif
if option = 0
dec number
print number
endif
I want you to go to the DarkBASIC command list and go under math to find more of these
math commands.
And when your ready let's move on.
################################################################################
Chapter 3: Text
################################################################################
Text is straightfoward
1D = Non-existant or is it?
2D = X Cordinate (across, or horizontal) and Y Cordinate (up and down or vertical)
3D = X, Y, and Z (In and Out)
4D = Foward and Backward or Time useless when it comes to games
5D = Hard to explain and useless period!
6D = Non-existant or is it?
text x,y,string$
val(string$) (turns a string into a number)
str$(integer) (turns a integer into a string)
set cursor x,y
ink rgb(red,green,blue),colornum
set text opaque
set text size sizenum
set text font desiretextfont$
As in the math not much of the rest is needed but view it anyways like you did with the math
if you want.
################################################################################
Chapter 4: Keyboard Input
################################################################################
if inkey$() = "a" then print "Yo"
if spacekey() = 1 then print "Hi"
if returnkey() = 1 then print "Dude"
if controlkey() = 1 then print "HEY"
View input for more examples of keyboard input.
################################################################################
Chapter 5: Arrays
################################################################################
dim a$(10)
a$(1) = "AAA"
dim a$(1,1)
a$(1,1) = "AAA"
dim a$(1,1,1)
a$(1,1,1) = "AAA"
Ah so what does that above mean? It means instead of using hundreds of different variable
names we made a group of variable names. Straightfoward Isn't it
################################################################################
I recommend you look at my 2D Tutorial (a work in progress) is out, and I recommend
Beginner's Guide to DarkBASIC Game Programming also.
PS: I might make a 3D Tutorial Later.
Peace.......
Some Guy
################################################################################
Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime