Guidance
指路人
g.yi.org
software / rapidq / Examples / Game / Labyrinth.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
     $INCLUDE "RAPIDQ.INC"
     $ESCAPECHARS ON
'Labyrinth - Written by Lode Van de Velde <lodchjo#yahoo.com>
'This is just the first stade in writing an illustrated text-adventure game
'I just wanted to get the walk-through interface right, before creating
'puzzles, objects, descripions and events.
'The possible exits are coded using prime numbers; just study the code,
'you'll see.
'originally written in Esperanto; that explains the names of some declarations...
     DIM MainForm AS QFORM
     DIM Norden AS QBUTTON, Suden AS QBUTTON, Orienten AS QBUTTON, Okcidenten AS QBUTTON
     DIM Tekstujo AS QRICHEDIT
     DIM El(20) AS LONG
     DIM nun AS SHORT
     DIM pasho AS SHORT
     pasho = 0
     nun = 23
     El(1)=5
     El(2)=3
     El(3)=105
     El(4)=35
     El(5)=5
     El(6)=30
     El(7)=7
     El(8)=10
     El(9)=6
     El(10)=70
     El(11)=6
     El(12)=105
     El(13)=14
     El(14)=15
     El(15)=462
     El(16)=15
     El(17)=14
     El(18)=5
     El(19)=2
     El(20)=5
     El(21)=6
     El(22)=21
     El(23)=42
     El(24)=21
     El(25)=14
     IF INT(El(nun)/2)=El(nun)/2 THEN norden.Visible = true ELSE norden.Visible=false
     IF INT(El(nun)/3)=El(nun)/3 THEN orienten.Visible= true ELSE orienten.Visible=false
     IF INT(El(nun)/5)=El(nun)/5 THEN suden.Visible = true ELSE suden.Visible=false
     IF INT(El(nun)/7)=El(nun)/7 THEN okcidenten.Visible=true ELSE okcidenten.Visible=false

     SUB norde
      pasho = pasho+1
      nun=nun-5
      Tekstujo.Text = STR$(pasho) + " - you went North" + CHR$(10) + Tekstujo.Text
      IF INT(El(nun)/2)=El(nun)/2 THEN norden.Visible = true ELSE norden.Visible=false
      IF INT(El(nun)/3)=El(nun)/3 THEN orienten.Visible= true ELSE orienten.Visible= false
      IF INT(El(nun)/5)=El(nun)/5 THEN suden.Visible = true ELSE suden.Visible=false
      IF INT(El(nun)/7)=El(nun)/7 THEN okcidenten.Visible= true ELSE okcidenten.Visible=false
      IF INT(El(nun)/11)=El(nun)/11 THEN SHOWMESSAGE("Congratulations! You succeeded in " + STR$(pasho) + " turns. The fastest way is 12 turns!"):END
     END SUB
     SUB sude
      pasho = pasho+1
      nun=nun+5
      Tekstujo.Text = STR$(pasho) + " - you went South" + CHR$(10) + Tekstujo.Text
      IF INT(El(nun)/2)=El(nun)/2 THEN norden.Visible = true ELSE norden.Visible=false
      IF INT(El(nun)/3)=El(nun)/3 THEN orienten.Visible= true ELSE orienten.Visible= false
      IF INT(El(nun)/5)=El(nun)/5 THEN suden.Visible = true ELSE suden.Visible=false
      IF INT(El(nun)/7)=El(nun)/7 THEN okcidenten.Visible= true ELSE okcidenten.Visible=false
      IF INT(El(nun)/11)=El(nun)/11 THEN SHOWMESSAGE("Congratulations! You succeeded in " + STR$(pasho) + " turns. The fastest way is 12 turns!"):END
     END SUB
     SUB oriente
      pasho = pasho+1
      nun=nun+1
      Tekstujo.Text = STR$(pasho) + " - you went East" + CHR$(10) + Tekstujo.Text
      IF INT(El(nun)/2)=El(nun)/2 THEN norden.Visible = true ELSE norden.Visible=false
      IF INT(El(nun)/3)=El(nun)/3 THEN orienten.Visible= true ELSE orienten.Visible= false
      IF INT(El(nun)/5)=El(nun)/5 THEN suden.Visible = true ELSE suden.Visible=false
      IF INT(El(nun)/7)=El(nun)/7 THEN okcidenten.Visible= true ELSE okcidenten.Visible=false
      IF INT(El(nun)/11)=El(nun)/11 THEN SHOWMESSAGE("Congratulations! You succeeded in " + STR$(pasho) + " turns. The fastest way is 12 turns!"):END
     END SUB
     SUB okcidente
      pasho = pasho+1
      nun=nun-1
      Tekstujo.Text = STR$(pasho) + " - you went West" + CHR$(10) + Tekstujo.Text
      IF INT(El(nun)/2)=El(nun)/2 THEN norden.Visible = true ELSE norden.Visible=false
      IF INT(El(nun)/3)=El(nun)/3 THEN orienten.Visible= true ELSE orienten.Visible= false
      IF INT(El(nun)/5)=El(nun)/5 THEN suden.Visible = true ELSE suden.Visible=false
      IF INT(El(nun)/7)=El(nun)/7 THEN okcidenten.Visible= true ELSE okcidenten.Visible=false
      IF INT(El(nun)/11)=El(nun)/11 THEN SHOWMESSAGE("Congratulations! You succeeded in " + STR$(pasho) + " turns. The fastest way is 12 turns!"):END
     END SUB

     Tekstujo.PARENT = MainForm
     Tekstujo.Left = 10
     Tekstujo.Top = 10
     Tekstujo.Width = 220
     Tekstujo.Height = 100
     Tekstujo.Scrollbars = ssBoth
     Tekstujo.Text="You came into a corridor and before you realized you've entered a labyrinth, the door slams shut behind you. Try to get out as soon as possible!"
     Norden.PARENT = MainForm
     Norden.Left = 100
     Norden.Top = 120
     Norden.Width = 60
     Norden.CAPTION = "&North"
     Norden.Onclick = Norde
     Orienten.PARENT = MainForm
     Orienten.Left = 170
     Orienten.Top = 155
     Orienten.Width = 60
     Orienten.CAPTION = "&East"
     Orienten.Onclick = Oriente
     Suden.PARENT = MainForm
     Suden.Left = 100
     Suden.Top = 190
     Suden.Width = 60
     Suden.CAPTION = "&South"
     Suden.Onclick = Sude
     Okcidenten.PARENT = MainForm
     Okcidenten.Left = 30
     Okcidenten.Top = 155
     Okcidenten.Width = 60
     Okcidenten.CAPTION = "&West"
     Okcidenten.Onclick = okcidente

     MainForm.Center
     MainForm.CAPTION = "Labyrinth"
     MainForm.Height = 250
     MainForm.Width = 250
     Mainform.COLOR = &H88FF88
     MainForm.SHOWMODAL
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Mon 2024-5-27  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2005-04-16 12:44:36