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 / Some Guy's 2D Tutorial For DBC - Make Pong, Break-Out and eventually Mario!

Author
Message
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 18:00 Edited at: 29th Aug 2005 22:21
#Some Guy's 2D Tutorial For DBC# **Skill Level: Beginner**
#############################
# Contents #
#############################
Chapter 1: Introduction and Pong
Chapter 2: Making a Break-Out Clone
Chapter 3: Making a Space Invader Clone
Chapter 4: Making a Defender Clone
Chapter 5: Making a Duck Hunt Clone
Chapter 6: A most awesome Pac-Man Clone
Chapter 7: Ratty a puzzle game (kinda)
Chapter 8: Boxing Knock-Out
Chapter 9: Tile-Master
Chapter 10: Character-Master
Chapter 11: A Mario Clone
Chapter 12: Yes it's a Final Fantasy Clone or Zelda Whatever You Want!
################################################################################
Chapter 1: Introduction and Pong
################################################################################
Section 1.A - The Introduction
###############################################################################
Welcome to my most awesome 2D Tutorial, I'm not very modest am I? Anyways, lots of people
start out with DarkBASIC (Classic) thinking that they're gonna make a great 3D Game in whatever
genre. They're told to start small and make text games or pong whatever, then what then? What's
after the beginning? Most tutorials on the TGC forums (no offense) are vague, or more geared
towards an abousulte noob. Or not done at all, or else they die out. These tutorials will have a
beginner section don't worry, and at the end you will hopefully be a little better and do 2D games
better. You won't be an expert programmer, or 2D Master. It takes years to program and be
consider above noob status. This makes alot of people angry, but it's true at least you can be
happy that you don't have to program C++/C or Direct X SDK. This takes lots of work and quite
frankly it's geared for expert programmers. At least from what I heard, in the old days of
programming they used Assembly. Oh that's easy you say, no it's hard Assembly uses
commands like POP, etc. Before Direct X there was DOS games were made for, engines need
to be made when you work with C. Several thousand lines of code later, and a flaming keyboard
later your hands are sore and bleeding. Guess what you're just done with the engine, or you can
buy one that takes thousands of dollars. So, let's be happy with DBC and save C++ when we
make our own blockbuster game that is the true halo-killer. So that's why commerical games take
longer.

Your First Assignment - Check out some DBC games in the TGC Showcase under DBC.

Man, I wish I had that assignment before in school!

This Ends Section 1.A
################################################################################
Section 1.B - Tips and Hints On Posting On the TGC Forums
################################################################################
Some newcomers sometimes post things that may attract a flamer. Or as I can them bullies,
this results in hurt feelings and the average flamer feeling good about themselves because they
just insulted a human being with real feelings not a robot.

***You can skip this if you'd like***

Team Requests: Don't post any team requests period, unless you got a big bag full of info about
your game, games you made, a demo, source code, etc.

Game Accounments: Unless you have a screenshot, and later a demo don't post anything
dealing with a WIP (Work in progress) post. Make sure you tell about your game, and you could
post code snippets or something if you wish.

Info about your website: One user did this and man did he get flamed! TGC forum users use the
TGC forums.

Flame: Don't flame anybody it can really hurt someones feelings and make them just give up
using the forum.

What does it mean when a thread as a lock on it?: It means no one can post on the thread any
more because it's a really old thread or did not agree to the terms of conditions on TGC Forums.

What does it mean when a thread is red?: It means it a old thread about 30 days old or
something?

I can't see my post!: If your new you posts get checked before they are posted don't worry
it's not because they hate newcomers it's because they seeing if you post garbage like flames
or if you are agreeing to the terms of condition.

What boards should I use?: 2D All The Way, Newcomer Board, and the DBC Board for
newcomers or really whatever you want as long as you agree to the terms of condition.
################################################################################
Section 1.C - 4 Beginners Only
################################################################################
Okay this one's for somebody who just started. By the way try DarkEDIT it's a better editor.

Rem Crazy Lib
Rem A Mad Lib Game By <Instert your name here>

Rem Print prints text on screen, input allows user input
Rem Rem statements are skipped
Rem Variables allow you to store data
Rem string$ = "aaaaa", real# = 1.000232,integer = 12
Rem Input is a blocking command, it gets done first

input "Enter A Male Name> ",name$
input "Enter An Animal> ",animal$
input "Enter A Town> ",town$
input "Enter A Decimal Number> ",decimal#
Input "Enter Your Favorite Number> ",favenum
input "Enter A Plant> ",plant$
input "Your Name> ",yname$
Print "Okay Press Any Key To Clear the screen!"

rem wait key can be used in this situation, you can also use wait timetowait, sleep timetowait,
rem or suspend for key.

wait key

rem cls clears the screen of text and what not
cls

rem now the story
Print "There once was a king named ";name$;" that lived in the kingdom of ";town$
Print "He had a big allergy to ";animal$;"s and ";plant$;"s "
print "So one day his trusty knight ";yname$;" said I'm gonna add ";decimal#;" and ";favenum
Print "Together to find a cure for this allergy"
Print "And the knight did"
Print "Sorry this was short THE END"
wait key

rem end does just that ends the program
end
################################################################################
Section 1.D - Ping a Pong Clone
################################################################################
Ah pong, some say it was the first video game or arcade game for that matter but they're wrong.
Space Wars I think that's what it was called was the first game, it was too hard for the general
public since no one played a game before. The future founder of Atari I forget his name, tried
he (I think he did) to make a computer version of the first game called Computer Space. After the
company he worked with the same one that made the first game wouldn't agree to pay him extra
he quit and started atari which means go or check mate. Ping-Pong was copyrighted and pong
was the noise the ball made when it impacted so this began Pong. Pong was very successful
no doubt, this ends Video Game History 101, but if you want you can check out
www.classicgaming.com for a history of video games that's told better then how I told it.

It's get to making our game!

You can open up the source code, or you can view the exe file if you wish. I'd like for you to
make it on your own first. Unzip the media and stuff you'll need first before anything happens.

Source Code:

` You can use the ` Sign instead of Rem to shorter things up
` Ping
` The Chapter 1 Tutorial Game

` Setup Display
` Sync tells the computer you will be manually updating the screen
` The sync rate tells the computer how fast to update it when you put in the sync command
sync on
sync rate 40
hide mouse

` Load all the images used as bitmaps, the number at the end is
`The images numeric name
load image "paddle1.bmp",1
load image "paddle2.bmp",2
load image "ball.bmp",3

` Load the music we will be using, the number means the same
` As in the load image command
load music "Dodge This.mid",1

` Load the sound thump
load sound "thump.wav",1

` Play the music we use, which is music 1 or Dodge This
play music 1

` Start the main game loop
` Setup some variables first, all of these variables are integer ` ` ` ` numbers
oneypos = 1
onexpos = 1
twoypos = 1
twoxpos = 620
bally = 150
ballx = 150
movey = rnd(1)
movex = rnd(1)
onegoal = 0
twogoal = 0

do

`HUD or Heads Up Display
`This sets text to write over the other text on the screen
set text opaque
text 1,1,"Goals: "+str$(onegoal)
text 585,1,"Goals: "+str$(twogoal)

` Player 1 Paddle
` This means if the upkey is pressed then we'll move up one space
` Vertically
` The if downkey is pressed we're gonna be doing the opposite move
` Down
` This means if the variable for the paddle's y position oneypos
` Is less the 1 then move it down
` And if it's greater then 432 move it up

if upkey() = 1 then oneypos = oneypos - 7
if downkey() = 1 then oneypos = oneypos + 7
if oneypos < 1 then oneypos = oneypos + 7
if oneypos > 432 then oneypos = oneypos - 7

`The sprite command calls an object to be put on screen
` Sprite spritenum,x,y,imagenum or frame
sprite 1,onexpos,oneypos,1

`Player 2 Paddle
`This is mostly the same as above only with paddle 2.

if inkey$() = "w" then twoypos = twoypos - 7
if inkey$() = "s" then twoypos = twoypos + 7
sprite 2,twoxpos,twoypos,2
if twoypos < 1 then twoypos = twoypos + 7
if twoypos > 432 then twoypos = twoypos - 7

`The Ball
`We use a for next loop to create it's bouncing effect
`Remember movey = rnd(1) and movex = rnd(1)
`This means that you move down if movey is equal to one
`Or up in the case it is equal to 0
`If movex is = to 1 we move across right
` Or if it's equal to zero we move left
if movey = 1 then bally = bally + 5
if movey = 0 then bally = bally - 5
if movex = 1 then ballx = ballx + 5
if movex = 0 then ballx = ballx - 5
sprite 3,ballx,bally,3

`This means if the paddle 1 or 2 is hit the ball will move
if sprite hit(1,3) = 1 then movex = 1:play sound 1
if sprite hit(2,3) = 1 then movex = 0:play sound 1
if ballx < 1 then movex = 1:twogoal = twogoal + 1:play sound 1
if ballx > 620 then movex = 0:onegoal = onegoal + 1:play sound 1
if bally < 1 then movey = 1:play sound 1
if bally > 432 then movey = 0:play sound 1

`Wins
`We use if endif for long conditional statements
`Text can be used instead of print also
` text x,y,string$
if onegoal = 10
text 100,150,"Player 1 Has Won!"
wait 300
end
endif

if twogoal = 10
text 100,150,"Player 2 Has Won!"
wait 300
end
endif

`Refresh the screen
sync

loop

`End of Main Game Loop

Explained:

You use comments in your program to let you know what you were thinking when you
programmed the application.

Here's some examples of comments:

` Setup the display
Rem Blast the Aliens

Remstart
a group of comments started
remend

Sync is used for updating the screen manually

Loops to something until a condition is met such as this

Repeat
Print "HELLO HELLO HELLO!"
until stopprint = 1

While printtext = 1
Print "HI HI HI HI"
endwhile

For a = 1 to 200
print "YO"
next a

do
cls
text mousex(),mousey(),"I'm Following Your Mouse!"
loop

Text
Some find text boring others make text games, I like a text game personally.

Try these examples:

`This colors text the red index (r), the blue index (b) and the green index(g) and numeric
`Name of the color you give it so!
ink rgb(red,green,blue),colornum

set cursor x,y
Print string

text x,y,string

set text size textsize

set text font textfont (string)

If then statements are conditions, if endif is used when a condition is longer.

Give yourself a pat on the back you made your first game or at least your first pong game. Take
awhile play it with friends, and then get ready for a pop quiz.

***Quiz Time***

The Print Command Is Used For Printing Text?

True or False

The Repeat Until Loop Is Used In Our Pong Clone?

True or False

This is not an example of a real variable:
True or False
a# = 12.9818

Which is a string variable?:

1) a$ = "AAAA"
2) a# = 12444.11
3) a = 123

You can use the str$ command for converting a string to an integer?:

True or False



You can download the media, no source, or exe

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime

Attachments

Login to view attachments
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 18:03
Chapter 2 Will Be Posted Soon. Later today soon. Just need to work
out the bugs in the highscore tables.

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 29th Aug 2005 19:24
wow that would be good when you have all chapters!


Current Project: Stealth Operations (Fps)
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 29th Aug 2005 19:41
Quote: "ink rgb(red,green,blue),thenumbernameyougiveit"


Do you know exactly what this command does? What on earth does 'thenumbernameyougiveit' mean?

For goodness sake, please look up RGB in the help files so you understand what you are saying.

TDK_Man

CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 29th Aug 2005 20:00
lol


Current Project: Stealth Operations (Fps)
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 20:34
It means this ink rgb(0,255,0),1.
Geeze TDK your cranky today.

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 29th Aug 2005 20:38
Why 1 and not 0?

The second number is the color of the background when using opaque text. Wich means 'thenumbernameyougiveit' is a color. (rgb(0,0,0) = 0)

I'm saying this for the people that are trying to understand programming. You should be complete too, because it can be very confusing for a beginner.

Immunity and Annihalation makes Immunihalation...
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 29th Aug 2005 22:21
Okay I'll edit it, please if anyone sees anything wrong with the code
give me a suggestion.

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 30th Aug 2005 15:30
Some guy, I changed part of your code to add in a bit of AI with paddle 2, also add'd a bit to speed up the ball if no1 scores a goal, likewise slowing it down when someone does score, this also includes a max/min speed.

Might as well teach the beginners a small amount of AI whilst they go along... even if its only... 3-4 lines

*see download - includes someguys edited sourcecode and his media*

Attachments

Login to view attachments
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 30th Aug 2005 22:57
Geeze thanks!

If anybody has any suggestions tell me, and if anyone wants to mod
the code go ahead.

Here's Chapter 2,
Warning: Chapter 2 Has a Horrible Highscore Board!

################################################################################
Chapter 2: Making a Break-Out Clone
################################################################################
Atari also made more games then pong obviously, one such game was Break-Out. A game
where you used a paddle to break bricks and earn points. You had highscore tables, and
basically that's it. Anyways, a Break-Out clone is another perfect way towards mastering 2D
Game Programming.

**Sprites Their It**

The syntax for a sprite command is this: sprite spritenumber,x,y,imagenumber

Sprites are very important to 2D Game Programming.

**Arrays**

You will need to learn how to use arrays before you can start saving our highscores we will be
using.

You can start an array statement by using dim, undim can uncreate an array but you won't be
using it much. There are up to 3 dimensions of arrays.

**str$() and val()**
Str$() can be used to convert a integer number into a string, and val() can be used to convert
a string into a integer number.

**Saving Arrays**
You save arrays by using the save array command and in reverse use the load array command.

Now that we're clear it's time for us to start programming our break-out clone. Break-Down.

Note: Again you can download the media that was set as an attachment




Source Code:
` Break-Down
` A Break-Out! Clone

`Loading
text 100,150,"LOADING - Please Wait!"


`Setup display
sync on
sync rate 50
hide mouse


`Load Images Used As Bitmaps
Load image "paddle.bmp",1
load image "ball.bmp",2
load image "block1.bmp",3
load image "block3.bmp",4
load image "block5.bmp",5
load image "block4.bmp",6
load image "slow.bmp",7
load image "animation1.bmp",8
load image "animation2.bmp",9
load image "animation3.bmp",10
load image "animation4.bmp",11

`Load Sounds Used As Wave
load sound "thump.wav",1
load sound "hollow.wav",2

`Load music used as midi
Load music "Traxxion.mid",1
load music "Dodge This.mid",2

`Variables

xpos = 300
ypos = 450

bonusappear = rnd(5)

ballx = 300
bally = 400

movex = rnd(1)
movey = rnd(1)

lives = 3
score = 0

ballspeed = 3
destroy = 0

`Arrays


dim brick1x(13)
brick1x(3) = 50
brick1x(4) = 100
brick1x(5) = 150
brick1x(6) = 200
brick1x(7) = 250
brick1x(8) = 300
brick1x(9) = 350
brick1x(10) = 400
brick1x(11) = 450
brick1x(12) = 500
brick1x(13) = 550

dim bricky(13)
bricky(1) = 10
bricky(2) = 50
bricky(3) = 90
bricky(4) = 130

dim brick1dead(13)
brick1dead(3) = 0
brick1dead(4) = 0
brick1dead(5) = 0
brick1dead(6) = 0
brick1dead(7) = 0
brick1dead(8) = 0
brick1dead(9) = 0
brick1dead(10) = 0
brick1dead(11) = 0
brick1dead(12) = 0
brick1dead(13) = 0

dim brick2x(24)
brick2x(14) = 50
brick2x(15) = 100
brick2x(16) = 150
brick2x(17) = 200
brick2x(18) = 250
brick2x(19) = 300
brick2x(20) = 350
brick2x(21) = 400
brick2x(22) = 450
brick2x(23) = 500
brick2x(24) = 550

dim brick2dead(24)
brick2dead(14) = 0
brick2dead(15) = 0
brick2dead(16) = 0
brick2dead(17) = 0
brick2dead(18) = 0
brick2dead(19) = 0
brick2dead(20) = 0
brick2dead(21) = 0
brick2dead(22) = 0
brick2dead(23) = 0
brick2dead(24) = 0

dim brick3x(35)
brick3x(25) = 50
brick3x(26) = 100
brick3x(27) = 150
brick3x(28) = 200
brick3x(29) = 250
brick3x(30) = 300
brick3x(31) = 350
brick3x(32) = 400
brick3x(33) = 450
brick3x(34) = 500
brick3x(35) = 550

dim brick3dead(35)
brick3dead(25) = 0
brick3dead(26) = 0
brick3dead(27) = 0
brick3dead(28) = 0
brick3dead(29) = 0
brick3dead(30) = 0
brick3dead(31) = 0
brick3dead(32) = 0
brick3dead(33) = 0
brick3dead(34) = 0
brick3dead(35) = 0

dim brick4x(46)
brick4x(36) = 50
brick4x(37) = 100
brick4x(38) = 150
brick4x(39) = 200
brick4x(40) = 250
brick4x(41) = 300
brick4x(42) = 350
brick4x(43) = 400
brick4x(44) = 450
brick4x(45) = 500
brick4x(46) = 550

dim brick4dead(46)
brick4dead(36) = 0
brick4dead(37) = 0
brick4dead(38) = 0
brick4dead(39) = 0
brick4dead(40) = 0
brick4dead(41) = 0
brick4dead(42) = 0
brick4dead(43) = 0
brick4dead(44) = 0
brick4dead(45) = 0
brick4dead(46) = 0

`Play Music
play music 1
loop music 1

`Get Ready Stuff
`This sets up a mini-animation
cls
do
text 300,200,"Get Ready!"

sprite 1,310,250,8

wait 600

sprite 1,310,250,9

wait 600

sprite 1,310,250,10

wait 600

sprite 1,310,250,11

wait 600

sprite 1,310,250,12

wait 600

sprite 1,310,250,13

wait 600

delete sprite 1

cls

exit

sync
loop
gosub startgame

`Main Game Loop
do
startgame:

`Player 1

if leftkey() = 1 then xpos = xpos - 7
if rightkey() = 1 then xpos = xpos + 7

sprite 1,xpos,ypos,1

if xpos < 1 then xpos = xpos + 7
if xpos > 600 then xpos = xpos - 7

`Ball
for xmove = 0 to 1
if movex = 1 then ballx = ballx + ballspeed
if movex = 0 then ballx = ballx - ballspeed
next xmove

for ymove = 0 to 1
if movey = 1 then bally = bally + ballspeed
if movey = 0 then bally = bally - ballspeed
next ymove

if ballx > 600 then movex = 0:play sound 2
if ballx < 1 then movex = 1:play sound 2
if bally < 1 then movey = 1:play sound 2

if bally > 450 then lives = lives - 1:play sound 2:stopit = 1

if stopit = 1
ballx = xpos + 10
bally = ypos - 25
movex = 2
movey = 2
endif

if spacekey() = 1 and stopit = 1
stopit = 0
movex = rnd(1)
movey = rnd(1)
endif

sprite 2,ballx,bally,2

if sprite collision(1,2) = 1 then movey = 0:play sound 2

`Hud
set text opaque
text 1,460,"Lives: "+str$(lives)
text 150,460,"Score: "+str$(score)
text 300,460,"Bricks Destroyed: "+str$(destroy)
text 500,460,"Break-Down!"

`Bricks

`Put bricks 3 to 13 on screen
for brick1 = 3 to 13
sprite brick1,brick1x(brick1),bricky(1),3
next brick1

`If the bricks 3 to 13 are hit destroy them
for aa = 3 to 13
if sprite hit(2,aa) = 1 then brick1dead(aa) = 1:play sound 1:score = score + 100:movey = 1:ballspeed = 4:destroy = destroy + 1
if brick1dead(aa) = 1 then brick1x(aa) = 800:delete sprite aa
next aa

`Put bricks 14 to 24 on the screen
for brick2 = 14 to 24
sprite brick2,brick2x(brick2),bricky(2),4
next brick2

`If the bricks 14 to 24 are hit destroy them
for ab = 14 to 24
if sprite hit(2,ab) = 1 then brick2dead(ab) = 1:play sound 1:score = score + 100:movey = 1:destroy = destroy + 1
if brick2dead(ab) = 1 then brick2x(ab) = 800:delete sprite ab
next ab

`Put bricks 25 to 35 on screen

for brick3 = 25 to 35
sprite brick3,brick3x(brick3),bricky(3),5
next brick3

`If bricks 25 to 35 is hit then destroy them

for ac = 25 to 35
if sprite hit(2,ac) = 1 then brick3dead(ac) = 1:play sound 1:score = score + 100:movey = 1:destroy = destroy + 1
if brick3dead(ac) = 1 then brick3x(ac) = 800:delete sprite ac
next ac

`Put bricks 36 to 46 on screen

for brick4 = 36 to 46
sprite brick4,brick4x(brick4),bricky(4),6
next brick4

`If sprites 36 to 46 are hit then destroy them

for ad = 36 to 46
if sprite hit(2,ad) = 1 then brick4dead(ad) = 1:play sound 1:score = score + 100:movey = 1:destroy = destroy + 1
if brick4dead(ad) = 1 then brick4x(ad) = 800:delete sprite ad
next ad

`Lives and Stuff

`If our player has no lives left then put text on the screen that says Game Over
`Then the computer is going to wait for 500 milliseconds and then jump to our highscore table
if lives = 0 then text 300,200,"Game Over!":wait 500:gosub highscores

`If our bricks are all destroyed do the positive version of what is above
if destroy = 44 then destroy = 0:text 120,150,"You Have Won!":wait 500:gosub highscores

`Refresh Screen
Sync

Loop
`End of Loop


`Highscores
highscores:

`Clear the screen
cls
paddledead = 1

for clearscreen = 1 to 50
if sprite exist(clearscreen) = 1 then delete sprite clearscreen
next clearscreen

if paddledead = 1 then xpos = 90000: ypos = 90000

`Create a 3-dimensional array called highscore

dim highscore$(5,1)
highscore$(1,0) = "None"
highscore$(2,0) = "None"
highscore$(3,0) = "None"
highscore$(4,0) = "None"
highscore$(5,0) = "None"
highscore$(1,1) = str$(score)
highscore$(2,1) = str$(score)
highscore$(3,1) = str$(score)
highscore$(4,1) = str$(score)
highscore$(5,1) = str$(score)

dim highscore(5,1)
highscore(1,0) = val(highscore$(1,0))
highscore(2,0) = val(highscore$(2,0))
highscore(3,0) = val(highscore$(3,0))
highscore(4,0) = val(highscore$(4,0))
highscore(5,0) = val(highscore$(5,0))
highscore(1,1) = val(highscore$(1,1))
highscore(2,1) = val(highscore$(2,1))
highscore(3,1) = val(highscore$(3,1))
highscore(4,1) = val(highscore$(4,1))
highscore(5,1) = val(highscore$(5,1))

if score >= val(highscore$(1,1)) then newscoreA = 1:newscoreB = 0:newscoreC = 0:newscoreD = 0
if score >= val(highscore$(2,1)) then newscoreB = 1:newscoreC = 0:newscoreD = 0:newscoreE = 0
if score >= val(highscore$(3,1)) then newscoreC = 1:newscoreD = 0:newscoreE = 0
if score >= val(highscore$(4,1)) then newscoreD = 1:newscoreE = 0
if score >= val(highscore$(5,1)) then newscoreE = 1:newscoreD = 0

if newscoreA = 1
input "New Highscore! Name Please!: ",name$
newscoreB = 0
newscoreC = 0
newscoreD = 0
newscoreE = 0
highscore$(1,0) = name$
highscore$(1,1) = str$(score)
if file exist("highscores.txt") = 1 then delete file "highscores.txt"

endif




if newscoreB = 1
input "New Highscore! Name Please!: ",name$
newscoreC = 0
newscoreD = 0
newscoreE = 0
highscore$(2,0) = name$
highscore$(2,1) = str$(score)
if file exist("highscores.txt") = 1 then delete file "highscores.txt"

endif



if newscoreC = 1
input "New Highscore! Name Please!: ",name$
newscoreD = 0
newscoreE = 0
highscore$(3,0) = name$
highscore$(3,1) = str$(score)

if file exist("highscores.txt") = 1 then delete file "highscores.txt"

endif


if newscoreD = 1
input "New Highscore! Name Please!: ",name$
newscoreE = 1
highscore$(4,0) = name$
highscore$(4,1) = str$(score)
if file exist("highscores.txt") = 1 then delete file "highscores.txt"

endif


if newscoreE = 1
input "New Highscore! Name Please!: ",name$
highscore$(5,0) = name$
highscore$(5,1) = str$(score)
endif
if file exist("highscores.txt") = 1 then delete file "highscores.txt"


for name = 1 to 5
ink rgb(255,0,0),1
Print "Name"
print highscore$(name,0)
next name

for score = 1 to 5
ink rgb(0,255,0),2
print "Score"
print highscore(score,1)
next score

text 1,450,"Press Any Key To Exit!"
wait key
end

The highscore board stinks I know. If anyone has any ideas on making a better please tell me,
I really need help with that highscore board.

Coming Tomorrow: Space Blasters.

Peace,

Some Guy

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime

Attachments

Login to view attachments
CaMeRoN H
19
Years of Service
User Offline
Joined: 21st Aug 2005
Location: Who knows?
Posted: 31st Aug 2005 02:15
Omg u rock nice tuts.


Current Project: Stealth Operations: Release Date: September
General Sephiro
20
Years of Service
User Offline
Joined: 27th Sep 2004
Location:
Posted: 31st Aug 2005 17:51
I fixed the high score table, now it saves to a file and is loaded at the start of the game. Changed the music... because my comp can play .mid files...

oh yea... and i think u were missing a slow.bmp file?

Also if the high score file is "accidently" deleted it will remake a new one with a few scores

All media including source is included under attachment as before
Hope it helps ye...

Attachments

Login to view attachments
Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 31st Aug 2005 17:58
I'll have the Space Invader clone up and running soon too.

Thanks for the response people!

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
Non Official Company Owner
19
Years of Service
User Offline
Joined: 1st Jul 2005
Location: ???????????
Posted: 1st Sep 2005 00:08
That is an Awsome Thread this should be a stiky when you complete this! I am looking foward to Chapter 11 and 12

??????????????????????????????????????????????????????????
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 1st Sep 2005 03:38 Edited at: 1st Sep 2005 03:40
Hey Some Guy!

Remember this post of yours last week?

http://forum.thegamecreators.com/?m=forum_view&t=59305&b=7

That was the 19th of August where I obviously wasted my time explaining in detail to you how to do a hiscore table. You even thanked me and said that it would help you a lot!

yet here you say:

Quote: "The highscore board stinks I know. If anyone has any ideas on making a better please tell me, I really need help with that highscore board."


You don't fool me - the problem was that I didn't give you a full working program that you could just paste into your tutorial did I? I just told you how to do it and you couldn't work it out yourself could you?

So now you've got someone else to do it for you! Well done - that's one thing at least you are good at.

Unfortunately, hiscore tables are not the only things you need help with sunshine!

At the risk of being screamed at by the mods and upsetting a few of your fans, I don't understand how you can get away with writing such drivel in a so-called tutorial.

When you write a tutorial, you are supposed to know what you are talking about - something you clearly do not.

A week ago, you were asking for help on the most basic of DB programming topics and here you are now - an expert. An expert on STRINGS! Let's see...

"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. "

Hmmm... no expert there then.

An expert on colours...

"ink rgb(red,green,blue),desirednumber"

Nope not there either. You didn't know what it meant. In fact even after being told what the parameters meant, you edited it to:

"ink rgb(red,green,blue),colornum"

So you still don't know!

In your code, you used the lines

ink rgb(255,0,0),1

and

ink rgb(255,0,0),2

which if you knew what it was doing, you would immediately know that it was just plain stupid.

An expert on arrays?

"`Create a 3-dimensional array called highscore
dim highscore$(5,1)"

Well, that's a 2-dimensional array you have there, so no expert status for you just yet...

An expert on variable conversion?

"Str$() can be used to convert a integer number into a string, and val() can be used to convert a string into a integer number."

What about floats? You nearly got my expert vote on that one, but not quite...

Look, I know I'm ranting here. I'm annoyed and have every reason to be. I went out of my way to explain something to you and you then say you don't know how to do it and ask others to do it for you. You wasted my time and you are a lamer.

From what I've seen of your abilities so far, I'm not so sure that I'm convinced that you even wrote the code in the tutorial.

If you don't fully understand the topic that you are writing a tutorial about then you simply shouldn't be writing it.

I know you are trying to do the best to help others, but if you are getting comments from other newcomers about how good your tutorials are, then they are soaking up bad information - which doesn't help anyone.

End of rant...

TDK_Man

Colonel Cool
19
Years of Service
User Offline
Joined: 3rd Aug 2005
Location: Somewhere
Posted: 1st Sep 2005 03:46 Edited at: 1st Sep 2005 03:51
I'm glad your done ranting no one likes a pessimest.
And newsflash I wrote these tutorials, and stop picking on me.
I just want to help people out, geeze back off.

And why are you so mad at me for?

This really makes me mad, I'm only 14 I get enought crap at school.

Formerly Ogre Software
My Current Project: Mystic I: Quest of A Lifetime
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 1st Sep 2005 04:42
Quote: "This really makes me mad"


How do you think it makes me feel. I help people when I can too - but most don't waste my time by ignoring what help I've given them.

If you didn't understand anything I put in my explanation of how to do a hiscore table, why didn't you ask for me to explain further at the time?

That's why I'm suggesting that you wanted me to write a complete working program for you, so you weren't really interested in actually knowing what to do when I didn't.

Well I'm sorry, but it doesn't work like that. If you want to learn to program, you can't be a copy and paste merchant - it doesn't work in the longrun.

If you don't want to actually learn how to program you are wasting everybody's time.

All I am asking is that you understand what you are writing.

If you don't then you are passing incorrect info on to others who are trying to learn. You're doing them no favours!

The Ink command has no 'colornum' parameter. As you have already been told, it's the background colour for when you print opaque text.

If you understood this, you wouldn't have put ink rgb(255,0,0),1 and ink rgb(255,0,0),2 in your code.

Do you really want other people who are learning to program to think that this is correct?

You don't write a tutorial full of factual errors and ask other people to correct them?

Nobody wants to stop you from writing a tutorial and I don't want to cause you any grief here on the forums. You just need to learn the subject of your tutorials properly.

Most (if not all) of the tutorial authors here have had years of programming experience. And even if someone with a lot less wrote one, I wouldn't complain if their facts were correct.

And sorry, pessimism doesn't come into it.

TDK_Man

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 1st Sep 2005 07:28
Some Guy, TDK is right. Have you ever heard the phrase?:

The blind leading the blind.

It's nice that you want to help people (as we all try to do)... but only make tutorials when your confident you're right. I'm not as much of a newbie as you are but I wouldn't dare write a tutorial... yet. Some day you'll write the best tutorial this place has ever seen... but not one month after getting Darkbasic.

TDK, like you I HATE it when newbies ignore my help. So far it's only happened once to me (knocking on wood).
Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 1st Sep 2005 17:37
I also agree with TDK.

You're only ready for writing tutorials when you have enough experience with DarkBasic.

When writing a tutorial, mistakes or uncertainties are the last thing that new people need. It may confuse them (look at the ink examples), or they may not understand the full potential of DB (look at the str$() and the val() examples).

I'm not saying you should stop with writing tutorials. In contrary, you're a pretty good writer. But next time, do a lot of research on the subject and try to be very complete. Reread the code when you're finished to avoid mistakes.

That was all,

Sven B

Immunity and Annihalation makes Immunihalation...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Sep 2005 23:49
Some Guy,
I know you're just trying to help out other newbies, but your teaching them bad habits and sometimes incorrect code (ink rgb(red,green,blue),thenumbernameyougiveit). And by bad habits, I mean this:
Quote: "sprite 1,310,250,8

wait 600

sprite 1,310,250,9

wait 600

sprite 1,310,250,10

wait 600

sprite 1,310,250,11

wait 600

sprite 1,310,250,12

wait 600

sprite 1,310,250,13

wait 600
"


learn about loops and recognizing patterns in your code.


For your own sake, and others, I think you should spend more time reading other ppl's tutorials (and the manual) before writing your own.

When I wrote my "image memblock" tutorial, I neglected to tell readers that the structure of the image I was using was for 32-bit mode. 16-bit mode was a tad different in terms of the size of memory used per pixel in the image, rather important info. Others pointed it out to me, and its been corrected.

The most important thing when teaching people, especially newcomers, is to have accurate information. Otherwise, you make yourself look bad and confuse others.

good luck.

Your signature has been erased by a mod because it's larger than 600x120...
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 2nd Sep 2005 01:39
Mario???
something like thaT?

[href][/href]

Attachments

Login to view attachments
RegenProZ
19
Years of Service
User Offline
Joined: 20th Aug 2005
Location:
Posted: 2nd Sep 2005 01:46
@Some Guy: OMFG Nice Tutorial, now go read the real tutorials...

In a way, your teaching newbs to be crapper than newbs..but overall, funny!

"Why do people depend on each other? In the end you're on your own." - Squall

Login to post a reply

Server time is: 2024-11-27 18:49:39
Your offset time is: 2024-11-27 18:49:39