text aventure : rooms

Game development specific discussions.
Post Reply
bluatigro
Posts: 660
Joined: Apr 25, 2012 10:35
Location: netherlands

text aventure : rooms

Post by bluatigro »

this is a simple text aventure
whit a simple world

the only thing have to think of
is a bigger world on disc
and a world-loader

Code: Select all

dim as string room( 20 ),item( 20 ) , a 
dim as integer n( 20 ) , e( 20 ) , s( 20 ) , w( 20 ) , d( 20 ) , u( 20 )
dim as string arm , ai
dim as integer i_n , ie , i_s , iw , id , iu , i
while arm <> "="
  read arm , i_n , ie , i_s , iw , id , iu , ai
  room( i ) = arm
  n( i ) = i_n
  e( i ) = ie
  s( i ) = i_s
  w( i ) = iw
  d( i ) = id
  u( i ) = iu
  item( i ) = ai
  i = i + 1
wend
''         room    n   e   s   w   d   u  item
data    "garden", 00 ,01 ,00 ,00 ,00 ,00 ,"plant"
data       "hal", 00 ,00 ,02 ,00 ,00 ,00 ,"umbrella"
data   "mainhal", 01 ,04 ,05 ,03 ,00 ,00 ,"magazine"
data  "mainroom", 00 ,02 ,00 ,00 ,00 ,00 ,"sigaret"
data "sleeproom", 00 ,00 ,00 ,02 ,06 ,07 ,"juwel"
data        "wc", 02 ,00 ,00 ,00 ,00 ,00 ,"calender"
data    "dungen", 00 ,00 ,00 ,00 ,00 ,04 ,"skeleton"
data      "atik", 00 ,00 ,00 ,00 ,04 ,00 ,"chest"
data         "=", 00 ,00 ,00 ,00 ,00 ,00  ,"="

dim as integer nu , items , steps
nu = 0
items = 0
steps = 0
print "Welkome by ROOMS ."
print "A text aventure by bluatigro ."
print "Object of the game :"
print "  steal as mutch as you can ."
dim as string in , z
while in <> "quit" and items < 8
  z = "quit"
  print
  print "You are in the " ; room( nu ) ; " ."
  if item( nu ) <> "quit" then
    print "You see a " ; item( nu ) ; " ."
    z = z + " " + item( nu )
  end if
  if n( nu ) > 0 then
    print "You can move north to the " _
    + room( n( nu ) ) + " ."
    z = z + " north"
  end if
  if e( nu ) > 0 then
    print "You can move east to the " _
    + room( e( nu ) ) + " ."
    z = z + " east"
  end if
  if s( nu ) > 0 then
    print "You can move south to the " _
    + room( s( nu ) ) + " ."
    z = z + " south"
  end if
  if w( nu ) > 0 then
    print "You can move west to the " _
    + room( w( nu ) ) + " ."
    z = z + " west"
  end if
  if d( nu ) > 0 then
    print "You can move down to the " _
    + room( d( nu ) ) + " ."
    z = z + " down"
  end if
  if u( nu ) > 0 then
    print "You can move up to the " _
    + room( u( nu ) ) + " ."
    z = z + " up"
  end if
  in = "qwerty"
  while instr( z , in ) = 0
    print "Choices : " ; z ; " ."
    input "Your choice = " ; in
  wend
  if in = item( nu ) then
    item( nu ) = "quit"
    items = items + 1
  end if
  if in = "north" then nu = n( nu )
  if in = "east"  then nu = e( nu )
  if in = "south" then nu = s( nu )
  if in = "west"  then nu = w( nu )
  if in = "down"  then nu = d( nu )
  if in = "up"    then nu = u( nu )
  steps = steps + 1
wend
print
dim as integer fl
fl = 0
for i = 0 to 20
  if item( i ) <> "quit" _
  and item( i ) <> "" then 
    fl = 1
  end if
next i
if fl then
  print "You stole only " ; items ; " items ."
else
  print "You stole al " ; items ; " items ."
end if
print "You took " ; steps ; " moves ."
print "You have " ; items * 10 - steps * 3 ; " points ."
print
print "GAME OVER ."
sleep
Gonzo
Posts: 722
Joined: Dec 11, 2005 22:46

Re: text aventure : rooms

Post by Gonzo »

nice game

Code: Select all

You stole only  8 items .
You took  21 moves .
You have  17 points .

GAME OVER .
apparently i only stole 8 items.. i must leave the thieving to others =)
HillbillyGeek
Posts: 50
Joined: Oct 27, 2011 1:51
Location: Texas
Contact:

Re: text aventure : rooms

Post by HillbillyGeek »

Promising work here.....I learned a lot by simply looking over it!
Post Reply