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 / Newcomer with questions

Author
Message
Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 8th Oct 2005 22:08
Hello everyone,
I bought DarkBasic retail several years ago and didn't have time to play

with it until recently by coding two small game programs:

- a text style adventure with 19 rooms based on some code from the 1983 Tim

Hartnell book "Creating Adventures on Your Computer"

- A one puzzle small 3dlevel using an animated character and some sounds from

two different 3D tutorials I found or linked to from this site.

For theme music in both games I used a clip of ambient style music that my

step-son's band produced and had posted on their website.

I wanted to get feedback on my first attempts at making a game so tried to

post the final executables for these games but they would not post and all I

got was a blank screen for the attempt.

Can anyone here explain to me why that happens?

My other question is about using parts of code and sounds I found in

tutorials to make these first experimental games.
- Is it acceptable to do that?

I credited the sources in the code on the text style game (although on the 3d

game, it is partially finished and I have not added credits yet.)

Should I instead post the code and send the media as an attachment?
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 9th Oct 2005 00:26
post the code, forget the media


Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 9th Oct 2005 02:14
Zotoaster,
Here is the code for the 3d game. Text game code in next post.
Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 9th Oct 2005 02:16
Zotoaster,
And here is the code for the text game.
Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 9th Oct 2005 02:39
Zotoaster,
Here is the code for the 3d game. Text game code in next post.


set display mode 1024,768,16
load sound \"sound.wav\",1
load sound \"engines.wav\",2
load sound \"powerdown.wav\",3
load music \"clip.mp3\",4
load sound \"beep.wav\",5
load sound \"menubeep.wav\",6
loop music 4


cls
`Hide mouse cursor
HIDE MOUSE

` Set random character attributes
RANDOMIZE TIMER()
holder=RND(100)
STRENGTH=RND(100)+75
WEALTH=RND(100)+50
OXY=RND(100)+30

TALLY=0
QQ=0

` # of aliens destroyed
MK=0

` Set up spaceship
DIM A(19,7)
FOR B=1 TO 19
FOR C=1 TO 7
READ A(B,C)
NEXT C
NEXT B

` Player Input
set text size 50
`ink rgb(0,0,255),1
center text 512, 384, \"SPACE DISASTER\"
set text size 12
`ink rgb(0,255,0),1
PRINT \"==================================================================\"
INPUT \"What is your name, Space Hero? \";PLAYER$
PRINT \"==================================================================\"
CLS

` First Room
RO=3

` Initialize Equipment
LASER=0
TRANSPORTER=0
ION=0
SUIT=0
LIGHT=0

` Allot Valuables
FOR T=1 TO 2
FOR J=1 TO 4
allot:
` RANDOMIZE TIMER()
M=RND(18)
IF M=6 OR M=11 OR M=13 OR A(M,7)<>0 THEN GOTO allot
A(M,7) = J+9
NEXT J
NEXT T

` Allot Aliens/Androids
FOR T = 1 TO 2
FOR J = 1 TO 4
alien:
` RANDOMIZE TIMER()
M = RND(18)
IF M=6 OR M=11 OR M=13 OR A(M,7)<>0 THEN GOTO alien
A(M,7) = J-(2*J)
NEXT J
NEXT T

`HELP AND INTRO SCREEN ****************************************
help:
CLS
`ink rgb(255,255,255),1
PRINT \"Version 2 - Azmovian like Text Adventure \"
PRINT \"By: Jim Wilbur - October 2005 \"
PRINT \"Programming strongly based on the Azimovian Listing\"
PRINT \"from \'Creating Adventures on You Computer\'\"
PRINT \"By: Tim Hartnell 1983 \"
PRINT \" \"
INPUT \"PRESS ENTER KEY TO CONTINUE....\";X$
IF A$ = \"H\" THEN GOTO what

`Story line *********************************************
CLS
PRINT \"S P A C E D I S A S T E R\"
PRINT \" \"
PRINT \"This story takes place in the far distant future when spaceships are huge,\"
PRINT \"almost like Cities. There has been a disaster aboard one of them.\"
PRINT \" \"
PRINT \"You are a space traveler who runs across one of these ships that seems to\"
PRINT \"be abandoned. You teleport into the ship, then get trapped inside. Your\"
PRINT \"goal is to escape the ship, alive.\"
PRINT \" \"
INPUT \"PRESS ENTER KEY TO CONTINUE....\";X$

` Supply Android ****************************************
CLS
supplyandroid:
PRINT player$;\", a supply android has arrived:\"
IF wealth>0 THEN PRINT \"You currently have $\";wealth;\" in solarian credits.\"
IF wealth=0 THEN PRINT \"You have no solarian credits left.\"
IF wealth<0 THEN PRINT \"You have tried to cheat me! \":wealth=0:suit=0:light=0:ion=0:laser=0:transporter=o:oxy=INT(OXY/4):SLEEP 1000
PRINT \"You currently have \";oxy;\" units of oxygen and:\"
PRINT light;\"-NL \";ion;\" -IG \";laser;\"-L \";transporter;\"-MT \";suit;\"-CS\"
PRINT \"==================================================================\"
PRINT \"You can buy:\":SLEEP 1000
PRINT \" 1 - Nucleonic Light ($15)\"
PRINT \" 2 - Ion Gun ($10)\"
PRINT \" 3 - Laser ($20)\"
PRINT \" 4 - Oxygen ($2 per unit)\"
PRINT \" 5 - Matter Transporter ($30)\"
PRINT \" 6 - Combat Suit ($50)\"
PRINT \" 0 - To continue exploration\"
PRINT \"==================================================================\"
INPUT \"Enter number of item required: \";Z
selecttool:
IF Z=0 THEN CLS : GOTO mainroutine
IF Z=1 AND light=0 THEN light=1:wealth=wealth-15 ELSE IF Z=1 AND LIGHT = 1 THEN PRINT \"You have a light\":SLEEP 3000
IF Z=2 THEN ion=1:wealth=wealth-10
IF Z=3 THEN laser=1:wealth=wealth-20
IF Z=4 THEN GOSUB buyoxygen
IF Z=5 THEN transporter=1:wealth=wealth-30
IF Z=6 THEN suit=1:wealth=wealth-50
CLS
GOTO supplyandroid
` End Supply Android ****************************************

` Buy Oxygen
buyoxygen:
INPUT \"How many units of oxygen? \";Q:Q=INT(Q):CLS
IF 2*Q>wealth THEN PRINT \"You haven\'t got enough money\"
oxy=oxy+Q
wealth=wealth-2*Q
RETURN

toobad:
`kills you off in room 13
IF RO=13 THEN QQ=QQ+1:IF QQ=2 THEN GOTO score
` *************** MAIN ROUTINE ***********************
mainroutine:
`Adding Sprites to Screen - Works Perfectly
`Load a bitmat
load bitmap \"score2.bmp\",1
`Grab image 1 from bitmap image#, Left, Top, Right, Bottom
get image 1,0,0,256,256
`Make one sprite from grabbed image
sprite 1,700,10,1
`Make a second sprite from grabbed image
`sprite 2,420,100,1
set current bitmap 0
CLS
TALLY=TALLY+1

` light
light:
IF LIGHT=0 THEN PRINT \"It is too dark to see anything.\"RINT \"Game Over\":END
IF LIGHT=1 AND TALLY=1 THEN PRINT \"Processing at 1970\'s processor speed...\":SLEEP 9000:GOTO rooms

goto rooms

continueroutine:
STRENGTH = STRENGTH-5
set cursor 10, 246 : IF STRENGTH<10 THEN PRINT \"Warning, Captain \";player$;\", your strength is running low. You need an oxygen boost.\"
IF STRENGTH<1 THEN GOTO death:
` K is set to content of rooms
K=A(RO,7)
IF K=0 THEN GOTO what

` Determines treasure in Room
set cursor 10, 316 : IF K>9 THEN PRINT \"There is treasure here worth $\";K : GOTO what

`Aliens/Androids are negative numbers. This skips to what if that is the case...
IF K>0 THEN GOTO what

` Determines Alien/Android in Room
set cursor 350, 276 : PRINT \"Danger....There is danger here....\"
IF K=-1 THEN M$=\"Berserk android\":FF=5
IF K=-2 THEN M$=\"Deranged Del-Finnian\":FF=10
IF K=-3 THEN M$=\"Rampaging robotic device\":FF=15
IF K=-4 THEN M$=\"Sniggering Green Alien\":FF=20
set cursor 350, 316 : PRINT \"It is a \";M$
set cursor 350, 336 : PRINT \"Your personal danger meter registers \";FF;\"!!\"

` ************ This is where most screen printing goes **************
what:
set cursor 710, 276 : print \"Strength: \",strength
set cursor 710, 296 : print \"Solarian Credits: \",wealth
set cursor 710, 316 : print \"Oyxgen: \",oxy
set cursor 710, 336 : print \"Aliens Killed : \",mk

set cursor 710, 396 : print \"I N V E N T O R Y\",
set cursor 710, 416 : print \"Ion Gun: \",ion
set cursor 710, 436 : print \"Laser: \",laser
set cursor 710, 456 : print \"Battle Armor: \",suit
set cursor 710, 476 : print \"Nucleonic Light: \",light
set cursor 710, 496 : print \"Transporter : \",transporter

`draw map
if rm1 = 1 then circle 810, 525, 4 : line 814, 525, 826, 525 : line 810, 529, 830, 541
if rm2 = 1 then circle 830, 525, 4 :
if rm3 = 1 then circle 850, 525, 4 : line 854, 525, 871, 525 : line 850, 529, 850, 541
if rm4 = 1 then circle 875, 525, 4 : `done
if rm5 = 1 then circle 830, 545, 4 : `done
if rm6 = 1 then circle 875, 605, 4 : line 879, 605, 884, 605 : line 884, 605, 884, 575 : line 850, 575, 884, 575 : line 850, 569, 850, 574
if rm7 = 1 then circle 850, 545, 4 : line 834, 545, 846, 545 : line 850, 529, 850, 541 : line 854, 545, 871, 545
if rm8 = 1 then circle 875, 545, 4 : line 875, 549, 875, 561
if rm9 = 1 then circle 810, 565, 4 : line 810, 555, 810, 561 : line 810, 555, 850, 555 : line 850, 561, 850, 555 : line 814, 565, 826, 565 : line 810, 569, 810, 581
if rm10 = 1 then circle 830, 565, 4 : line 814, 565, 826, 565 : line 830, 569, 830, 581
if rm11 = 1 then circle 850, 565, 4 : `done
if rm12 = 1 then circle 875, 565, 4 : line 875, 569, 875, 581
if rm13 = 1 then circle 810, 585, 4 : `done
if rm14 = 1 then circle 830, 585, 4 : line 820, 585, 826, 585 : line 820, 585, 820, 596 : line 810, 596, 820, 596 : line 810, 596, 810, 601 : line 834, 585, 846, 585 : line 830, 589, 830, 601
if rm15 = 1 then circle 850, 585, 4 : line 850, 589, 850, 601
if rm16 = 1 then circle 875, 585, 4 : line 875, 569, 875, 581
if rm17 = 1 then circle 810, 605, 4 : line 814, 605, 826, 605
if rm18 = 1 then circle 830, 605, 4 : line 834, 605, 840, 605 : line 840, 605, 840, 620 : line 840, 620, 862, 620 : line 862, 585, 862, 620 : line 862, 585, 871, 585
if rm19 = 1 then circle 850, 605, 4 : line 850, 589, 850, 601 : line 850, 609, 850, 615 : line 850, 615, 890, 615 : line 890, 565, 890, 615 : line 879, 565, 890, 565

`Help notes at bottom of main screen
set cursor 0, 705 : PRINT \"C O M M A N D S - [ CAPITALS ]\"
set cursor 0, 725 : PRINT \"N,S,E,W - directions B - Breath U,D - Up/Down F - Fight M - Teleport\"
set cursor 0, 745 : PRINT \"P - Pick up R - Run I - Supplies Q - Quit\"

`main page dividers
line 0, 266, 956, 266
line 698, 10, 698, 768
line 956, 266, 956, 768

` ************ This is where main input takes place **************
set cursor 10,276 : PRINT \"What do you want to do? \";
INPUT A$:A$=LEFT$(A$,1)
IF K<0 AND A$<>\"F\" AND A$<>\"R\" THEN GOTO what
RESTORE spaceship
SELECT A$
CASE \"N\" : IF A(RO,1)=0 THEN PRINT \"No exit that way.\" : GOTO what : ENDCASE
CASE \"N\" : RO=A(RO,1) : ENDCASE
CASE \"S\" : IF A(RO,2)=0 THEN PRINT \"There is no exit south.\" : GOTO what : ENDCASE
CASE \"S\" : RO=A(RO,2) : ENDCASE
CASE \"E\" : IF A(RO,3)=0 THEN PRINT \"You cannot go in that direction.\" : GOTO what : ENDCASE
CASE \"E\" : RO=A(RO,3) : ENDCASE
CASE \"W\" : IF A(RO,4)=0 THEN PRINT \"You cannot move through solid walls.\" : GOTO what : ENDCASE
CASE \"W\" : RO=A(RO,4) : ENDCASE
CASE \"U\" : IF A(RO,5)=0 THEN PRINT \"There is no way up from here.\" : GOTO what : ENDCASE
CASE \"U\" : RO=A(RO,5) : ENDCASE
CASE \"D\" : IF A(RO,6)=0 THEN PRINT \"You cannot descend from here.\" : GOTO what : ENDCASE
CASE \"D\" : RO=A(RO,6) : ENDCASE
CASE \"Q\" : GOTO score : ENDCASE
CASE \"R\" : IF RND(1)>.7 THEN GOTO norun : ENDCASE
CASE \"R\" : K=0:set cursor 10, 376 : PRINT \"Which way do you want to run? \" : GOTO what : ENDCASE
CASE \"F\" : IF A(RO,7)>-1 THEN PRINT \"There is nothing to fight here.\" : GOTO what : ENDCASE
CASE \"F\" : GOTO fight : ENDCASE
CASE \"I\" : CLS: GOTO supplyandroid : ENDCASE
CASE \"L\" : GOTO rooms : ENDCASE
CASE \"B\" : IF oxy=0 THEN PRINT \"You have no oxygen.\" : GOTO what : ENDCASE
CASE \"B\" : GOTO breath : ENDCASE
CASE \"P\" : GOTO treasure : ENDCASE
CASE \"M\" : IF transporter=0 THEN PRINT \"You don\'t have the Matter Transporter.\" : GOTO what : ENDCASE
CASE \"M\" : IF RO=13 THEN PRINT \"That is not possible.\" : GOTO toobad : ENDCASE
magain:
CASE \"M\" : IF transporter=1 THEN RO=RND(18)+1 : ENDCASE
CASE \"M\" : IF RO=6 OR RO=11 THEN GOTO magain ELSE GOTO rooms : ENDCASE
CASE DEFAULT center text 320,0, \"NOT IN RANGE\" : ENDCASE
ENDSELECT
` end of MAIN ROUTINE ***************************

` *************** ROOMS *******************************
rooms:
set cursor 0, 10
CLS
IF RO=1 THEN GOTO R1
IF RO=2 THEN GOTO R2
IF RO=3 THEN GOTO R3
IF RO=4 THEN GOTO R4
IF RO=5 THEN GOTO R5
IF RO=6 THEN GOTO R6
IF RO=7 THEN GOTO R7
IF RO=8 THEN GOTO R8
IF RO=9 THEN GOTO R9
IF RO=10 THEN GOTO R10
IF RO=11 THEN GOTO R11
IF RO=12 THEN GOTO R12
IF RO=13 THEN GOTO R13
IF RO=14 THEN GOTO R14
IF RO=15 THEN GOTO R15
IF RO=16 THEN GOTO R16
IF RO=17 THEN GOTO R17
IF RO=18 THEN GOTO R18
IF RO=19 THEN GOTO R19

R1:
play sound 6
PRINT \"You are in the former recreation center.\"
PRINT \"Equipment for muscle training in the zero gravity\"
PRINT \"environment of space litters the area.\"
rm1 = 1
GOTO continueroutine

R2:
play sound 5
PRINT \"This was the repair and maintenance hold of the ship.\"
PRINT \"You can only leave it via the giant hangar door far to\"
PRINT \"the west.\"
rm2 = 1
GOTO continueroutine

R3:
play sound 6
PRINT \"You are in the wrecked hold of a spaceship. The cavernous interior\"
PRINT \"is littered with floating wreckage as if from some terrible\"
PRINT \"explosion eons ago.\"
rm3 = 1
GOTO continueroutine

R4:
play sound 3
if rnd(1)>.6 then PRINT \"What a superb sight.....\"
PRINT \"The view of the stars from this observation\"
PRINT \"platform is magnificent, as far as the eye\"
PRINT \"can see. The single exit is back where you\"
PRINT \"came from.\"
rm4 = 1
GOTO continueroutine

R5:
play sound 5
PRINT \"Acre upon acre of dried up hydroponic plant beds\"
PRINT \"stretch around you. Once this area fed the thousand\"
PRINT \"aboard this ship.\"
if rnd(1)>.5 then PRINT \"The solar lamps are still shining.\"
if rnd(1)>.5 then PRINT \"A few plants are still alive to the east.\"
rm5 = 1
GOTO continueroutine

R6:
play sound 6
PRINT \"You are free!. You have made it.\"
PRINT \"Your pod sails free into space.....\"
rm6 = 1
GOTO score

R7:
play sound 5
PRINT \"You are in the crew\'s sleeping quarters\"
if rnd(1)>.5 then PRINT \"most of the sleeping shells are empty\"
if rnd(1)>.5 then PRINT \"the few remaining crew stir fitfully\" : PRINT \"in their endless, dreamless sleep.\"
if rnd(1)>.7 then PRINT \"There are exits to the north, east and west.\"
rm7 = 1
GOTO continueroutine

R8:
play sound 6
PRINT \"The former passenger suspended animation dormitory...\"
if rnd(1)>.5 then PRINT \"Passengers float by at random.\"
if rnd(1)>.5 then PRINT \"It is enormous. It seems to go on forever.\"
if rnd(1)>.9 then PRINT \"The only exits are to the west and south.\"
rm8 = 1
GOTO continueroutine

R9:
play sound 3
PRINT \"This is the ship\'s Hospital, white and sterile.\"
PRINT \"A buzzing sound and a strange warmth come from\"
PRINT \"the South while a chill is felt from the North.\"
PRINT \"There is a small sign on the wall advising you\"
PRINT \"not to head south...\"
rm9 = 1
GOTO continueroutine

R10:
play sound 5
PRINT \"Food for all the crew was prepared in this Galley.\"
PRINT \"The remains from the preparations of the last meal\"
PRINT \"can be seen. Doors leave the Galley to the South and\"
PRINT \"to the West.\"
rm10 = 1
GOTO continueroutine

R11:
play sound 3
PRINT \"Aha...That looks like the Space Pod now and its\"
PRINT \"outside dials seem to indicate that it is still\"
PRINT \"in perfect condition!\"
rm11 = 1
GOTO continueroutine

R12:
play sound 3
PRINT \"This is the Ship\'s Main Navigation Room. Strange\"
PRINT \"machinery lines the walls, while overhead, a holographic\"
PRINT \"Star Map slowly turns. By the flickering green light you\"
PRINT \"can just make out exits\"; : if rnd(1)>.8 then print \"to the south and to the east.\"
rm12 = 1
GOTO continueroutine

R13:
loop sound 2
PRINT player$;\" I take it you didn\'t read the sign...\"
PRINT \"or you are the type who hates obeying signs...\"
PRINT \"Either way -\"
PRINT \"You body twists and burns....\"
PRINT \"You are caught in a deadly radiation field\"
if rnd(1)>.6 then PRINT \"Slowly, you realize this is the End.\"
if rnd(1)>.6 then PRINT \"No matter what you do here, you are doomed to die.\"
rm13 = 1
GOTO mainroutine

R14:
play sound 2
PRINT \"This is the Power Center of the Ship. The\"
PRINT \"characteristic blue metal light of the still functioning\"
PRINT \"Ion Drive fills the Engine Room. Through the haze you\"
if rnd(1)>.9 then PRINT \"can see doors to the north and west. A shaft leads\"
if rnd(1)>.6 then PRINT \"downwards to the Repair Center.\"
rm14 = 1
GOTO continueroutine

R15:
play sound 6
PRINT \"You are standing in the Android Storage Hold. Row\"
PRINT \"upon row of metal men stand stiffly at attention,\"
PRINT \"awaiting the distinctive sound of their long dead\"
PRINT \"Captain to set them into motion. A light comes from\"
PRINT \"the west and through the Gravity Well set into the floor.\"
rm15 = 1
GOTO continueroutine

R16:
play sound 5
PRINT \"Another cavernous, seemingly endless hold, this one\"
PRINT \"crammed with goods for trading...\"
if rnd(1)>.7 then PRINT \"Rare metals and Venusian Sculptures...\"
if rnd(1)>.8 then PRINT \"preserved Scalapian Desert Fish...\"
if rnd(1)>.7 then PRINT \"flasing Ebony Scith Stones from Xarizx IV\"
if rnd(1)>.8 then PRINT \"awesome Trader Ant Effigies from the Qwertyiopian Empire.\"
if rnd(1)>.9 then PRINT \"The light is stronger to the west.\"
rm16 = 1
GOTO continueroutine

R17:
play sound 3
PRINT \"A stark metallic room reeks of lubricants. Weapons line the\"
PRINT \"wall...rank upon rank. Exits for Soldier Androids are to the\"
PRINT \"north and the east.\"
rm17 = 1
GOTO continueroutine

R18:
play sound 2
PRINT \"Above you is the gravity shaft leading to the Engine Room.\"
PRINT \"This is the Ship Repair Center with emergency exits\"
PRINT \"to the Soldier Android Storage and to the Trading Goods Hold.\"
rm18 = 1
GOTO continueroutine

R19:
play sound 6
PRINT \"Youv\'e stumbled on the secret Command Center where screens\"
PRINT \"bring views from all around the ship. There are two exits -\"
if rnd(1)>.5 then PRINT \"one of which is the Gravity Well\" else PRINT \"one which leads to theGoods Hold.\"
rm19 = 1
GOTO continueroutine

` Treasure
treasure:
CLS
IF A(RO,7)<10 THEN set cursor 10, 296 : PRINT \"There is nothing of value here.\" : GOTO what
IF LIGHT=0 THEN set cursor 10, 296 : PRINT \"You cannot see where it is.\" : GOTO what
wealth=wealth+A(RO,7)
set cursor 10, 296 : PRINT \"You pick up the treasure.\"
A(RO,7)=0:A$=\"\"
GOTO rooms

` You can\'t run
norun:
set cursor 10, 356 : PRINT \"You must stand and fight.\"
A$=\"F\"
GOTO what

` Replenish Oxygen
CLS
breath:
IF oxy<1 THEN GOTO what
set cursor 10, 296 : PRINT \"You have \";oxy;\" units of oxygen left.\"
set cursor 10, 316 : PRINT \"How many do you want to add to your tanks? \";
zoxy:
INPUT Z
IF Z>oxy THEN GOTO zoxy
oxy=INT(oxy-Z)
strength=INT(strength+5*Z)
SLEEP 1000
CLS
GOTO rooms

` Fight Routine
fight:
` Armor Handling
set cursor 0, 376 : IF suit>=1 THEN PRINT \"Your Combat Armor increases your chance of success\":
FF=3*(INT(FF/4)):SLEEP 1000

` Graphics
set cursor 0, 396 : FOR J=1 TO RND(7)RINT \"*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*\":
NEXT J
SLEEP 2000

` Weapon handling
IF ion=0 AND laser=0 THEN PRINT \"You have no weapons.\"RINT \"You must fight with bare hands\":FF=INT(FF+FF/5):GOTO battle
IF ion=1 AND laser=0 THEN PRINT \"You have only the Ion Gun to fight with.\":FF=4*INT(FF/5): GOTO battle
IF ion=0 AND laser=1 THEN PRINT \"You must fight with your Laser.\":FF=3*INT(FF/4): GOTO battle

chooseweapon:
INPUT \"Which Weapon? 1- Ion Gun, 2- Laser \";Z
IF Z<1 OR Z>2 THEN GOTO chooseweapon
IF Z=1 THEN FF=4*INT(FF/5)
IF Z=2 THEN FF=3*INT(FF/4)

` Battle Routine
battle:
CLS
IF RND(1)>.5 THEN PRINT M$;\" Attacks\" ELSE PRINT \"You Attack\": play sound 1 : SLEEP 1900
IF RND(1)>.5 THEN PRINT \"You give the \";M$;\" a glancing blow\" : FF=INT(5*FF/6) : SLEEP 1900
IF RND(1)>.5 THEN PRINT \"The \";M$;\" wounds you!\":strength=strength-5: play sound 1 : SLEEP 1900
IF RND(1)>.35 THEN GOTO battle
PRINT \"The \";M$;\" seriously wounds you\": play sound 1 : strength=INT(strength/2) : SLEEP 1900
IF RND(1)*16>FF THEN PRINT \"and you manage to kill the \";M$:MK=MK+1: play sound 1 : A(RO,7)=0:K=0:M$=\"\":FF=0:A$=\"\":SLEEP 1900

` At end of Fight
GOTO rooms

` Room Data ****************************************************
spaceship:
DATA 0,5,2,0,0,0,0:` Room 1
DATA 0,0,0,1,0,0,0:` Room 2
DATA 0,7,4,0,0,0,0:` Room 3 - START
DATA 0,0,0,3,0,0,0:` Room 4
DATA 1,5,7,5,5,5,0:` Room 5
DATA 6,6,6,6,6,6,0:` Room 6
DATA 3,0,8,5,0,0,0:` Room 7
DATA 8,12,8,7,8,8,0:` Room 8
DATA 11,13,10,0,0,0,0:` Room 9
DATA 0,14,0,9,0,0,0:` Room 10
DATA 9,6,6,6,6,6,0:` Room 11
DATA 8,16,19,0,0,0,0:` Room 12
DATA 13,0,0,13,0,13,0:` Room 13
DATA 10,0,15,17,0,18,0:` Room 14
DATA 0,0,0,14,0,19,0:` Room 15
DATA 12,16,16,18,16,16,0:` Room 16
DATA 14,0,18,0,0,0,0:` Room 17
DATA 0,0,16,17,14,0,0:` Room 18
DATA 0,12,0,0,15,0,0:` Room 19

` Death
death:
set cursor 10, 316 : PRINT \"You have run out of oxygen...\"
SLEEP 3000
GOTO score:

` Score
score:
PRINT \"Your score was \";3*TALLY + 5*STRENGTH + 2*WEALTH + 10*OXY +30*MK
PRINT \" \"
PRINT player$; \" I hope you enjoyed this adventure.\"
PRINT \"\"
PRINT \"CREDITS:\"
PRINT \"Music from Joy Wants Eternity - http://www.joywantseternity.com\"
PRINT \"Sounds From Binary Moon - http://www.binarymoon.co.uk\"
PRINT \"Created with Dark Basic - www.DarkBasic.com\"
PRINT \"Concept - Adapted from Tim Hartnell\'s Book:\"
PRINT \"Creating Adventures on your Computer - 1983\"
PRINT \"Adaptation, Graphics, Coding, Testing, Distribution - Jim Wilbur\"
PRINT \"Contact: jwwilbur50@yahoo.com\"
PRINT \"NOTE: This is freeware.\"
END
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Oct 2005 05:21
It obviously wasn't one of my tutorials - I saw the evil GOTO statement in the code!!

As an aside, using books that old as reference material is OK for theory, but definitely a no-no for source code.

The BASIC language has moved on leaps and bounds since the early eighties and things you can do now just weren't available back then. Goto is a prime example and just isn't necessary these days.

http://www.matedit.com is where you'll find my tutorials which you will find a little more relevant.

And BTW - you've not posted enough to get out of newbie status, so you can't attach files yet or use the code box. Use the code button for that while you wait for user status...

TDK_Man

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Oct 2005 05:41
I tried loading it in Pro first and Pro really, really hates this program... even after removing all the \'s. There are a few bugs because it wasn't in code snips. Some of the lines were translated to 's.

It is interesting to see a text adventure over before it starts because the player didn't but a Nucleonic Light.
Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 9th Oct 2005 10:25
TDK & Grog,
Thank you for the comments. I'm using DarkBasic Classic 1.13 enhanced. Yes, you need a Nucleonic light, guess I could be a bit kinder about that.
TDK, I have been to the matedit site but currently all I get is a Title page with no links. The book I used was the only book I had at the time I started writing this program. I was just sort of curious as to whether or not the basic language of 22 years ago could be used as a starting point in DarkBasic, since the last time I did any pseudo-serious programming in basic was about that long ago. And thank you for the heads up regarding file attachments and code - I was rather puzzled.
BTW -I tried using the code button but I kept getting an unexpected error when trying to post with that tag.
Antidote
19
Years of Service
User Offline
Joined: 18th Mar 2005
Location: San Francisco, CA
Posted: 10th Oct 2005 00:59 Edited at: 10th Oct 2005 01:00
Quote: "I saw the evil GOTO statement in the code!!"


GOTO is bad GOSUB is ok for DBP because it actually runs faster than functions.

I R tEh Antid0te! ROOOAAAR!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Oct 2005 03:18
Inaholler:

The links are visible for me when I view the site at 800x600 and above, so I'm not sure what the problem is there.

Anyway, to go straight to the DB section, use the following link:

http://www.matedit.com/db.htm

TDK_Man

Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 10th Oct 2005 07:47
TDK,
I got rid of all the gosubs and the program does run faster, although I put alot of 'sleeps' in to make the game feel like an old text adventure on an old machine. I also changed the code and created several functions that work and fixed several bugs.
The new link you provided works great and I will do the tutorials and check it out. I can see that you have done a great deal of work to provide support for DarkBasic and to enrich the content of this community. This community is lucky to have your participation.
Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 10th Oct 2005 07:49
Grog,
I fixed the Neucleonic light to be a bit kinder.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Oct 2005 08:31
Quote: "BTW -I tried using the code button but I kept getting an unexpected error when trying to post with that tag. "


You can just type it out. (remove the spaces between the brakets)
[ code ]
Paste code here.
[ /code ]
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Oct 2005 14:46
Quote: "I got rid of all the gosubs and the program does run faster"


I hope you mean GOTO's lol!

TDK_Man

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 10th Oct 2005 21:29
Quote: "I got rid of all the gosubs and the program does run faster, although I put alot of 'sleeps' in to make the game feel like an old text adventure on an old machine. I also changed the code and created several functions that work and fixed several bugs."


I was wondering why you had that line "Processing at 1970's processor speed..." The only text adventures I played were from Infocom... high quality games are never slow.

Quote: "The new link you provided works great and I will do the tutorials and check it out. I can see that you have done a great deal of work to provide support for DarkBasic and to enrich the content of this community. This community is lucky to have your participation. "


Yeah TDK has a big fan club (i'm in it ). Sorry TDK... just because the thread talking about your coolness is locked doesn't mean your fan club is gone.
Inaholler
19
Years of Service
User Offline
Joined: 31st Aug 2005
Location: A hollow in the woods
Posted: 11th Oct 2005 04:17
Quote: "I got rid of all the gosubs and the program does run faster"
It was late... Yes it was the goto's.
Quote: "The only text adventures I played were from Infocom... high quality games are never slow. "

I don't know about that, on my old Apple Plus computer(I think that is what it was called) and my Vic 20 before that and my Timex before that even some good games like the first Ultima games would run slow as I recall.

Login to post a reply

Server time is: 2024-11-27 16:50:25
Your offset time is: 2024-11-27 16:50:25