Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SPACE <insert word pertaining to fighting>
#1
WELL! My pal and me began to work on a game over the summer. Basically it's going to go like this:

You are a captain of a space ship in the future, in a solar system much like our own. You can follow various paths, such as piracy, military career, trading, or making allies with small colonies and generally being a nice guy. Or maybe a mix of all of em.

Anyways, that’s the extreme basics.

Since then, we initiated it at our schools Computer Tech Club, as our first club project. (We only started the club a month ago and our first objective was to learn some intro programming, so I decided QB would be a good one to start everyone off with.)

I thought I should post up the source here so you guys can give criticism throughout. I wont actualy post the whole thing every time, just bits n' pieces.

The code im posting here is NOT DONE AT ALL, so dont get confused.

Here it is so far, written by me and my friend Jeremie.
(I coded 2 hours straight last night to finish the kludge of an AI in the battle engine)

Code:
DECLARE SUB BATTLSYS ()
DECLARE SUB WARP (planet%)
DECLARE SUB REDIRNEWS ()
DECLARE SUB MAPEARTH ()
DECLARE SUB MAP ()
DECLARE SUB MAIN ()
DECLARE SUB MAPEARTH ()
DECLARE SUB MAPMARS ()
DECLARE SUB MAPASTER ()
DECLARE SUB MAPTITAN ()
DECLARE SUB TUTORIAL1 ()

COMMON SHARED INTRO%, NEWS%

CONST false% = 0, TRUE% = NOT false

TYPE Pstats
NAYM AS STRING * 5
OWNER AS STRING * 10
NEWS AS STRING * 1
END TYPE
DIM SHARED planet(3) AS Pstats

NUM% = 10 'temp variable
TYPE SHIPSTATS
  NAYM AS STRING * 7
  WEAPON AS INTEGER
  SHIELD AS INTEGER
  SPEED AS INTEGER
  HULL AS INTEGER
  FUEL AS INTEGER
  POWER AS INTEGER
END TYPE
DIM SHARED SHIP(NUM%) AS SHIPSTATS

NEWS% = 1

CALL MAIN

SUB BATTLSYS
CLS

'****************************************************************************
'                             Zoaster Tech
'                            Battle system 1.0
'                   By Jeremie Fernando and Josh Davidson
'****************************************************************************

101 SCREEN 12

'Scafolding for ships variable values
SHIP(1).NAYM = "CRUISER"
SHIP(1).WEAPON = 10
SHIP(1).SHIELD = 10
SHIP(1).HULL = 100
WEPOWER% = 10
' This is only a test model

RANDOMIZE TIMER 'This decides the enemy ships...
FOR r = 1 TO 1
  aleg% = INT(RND * 6) + 1     'Alegance
  enhull% = INT(RND * 200) + 1 'hull strength
  enshield% = INT(RND * 100) + 1
  enloc% = INT(RND * 10) + 1   'location
  enwepower% = INT(RND * 30) + 1  'Wepon power
NEXT

PRINT "COMPUTER: Incoming ship detected."
PRINT ""
PRINT "1. Engage"
PRINT "2. Ignore"
PRINT "3. Hail"
INPUT choice1%
IF choice1% = 1 THEN
  PLAY "o1 l20 a"
  PRINT "NAVIGATOR: I'm checking the ships specs..."
  PLAY "o1 l20 a p10 a p10 a"
END IF
IF choice1% = 2 THEN
  GOTO 131
END IF
IF choice1% = 3 THEN
  GOTO 401
END IF

IF aleg% = 1 THEN
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: Ship confirmed as pirates! Sir!"
ELSEIF aleg% = 2 THEN
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: Ship confirmed as an enemy fighter."
ELSEIF aleg% = 3 THEN
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: Confirmed as an enemy cargo ship sir."
ELSEIF aleg% = 4 THEN
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: Confirmed friendly fighter captain."
ELSEIF aleg% = 5 THEN
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: It's an allied cargo ship sir."
ELSEIF aleg% = 6 THEN
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: It's a nuetral cargo ship captain."
END IF
PLAY "o1 l20 p10 a"
INPUT "NAVIGATOR: Would you like to continue the attack (y,n) "; continue$
IF continue$ = "n" THEN
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: The attack is called off, pulling away."
  GOTO 121
ELSE
  PLAY "o1 l20 p10 a"
  PRINT "NAVIGATOR: Yes sir."
END IF

PLAY "o1 l20 p10 a"
2501 PRINT "CREW COMMANDER: What ship will launch the attack captain?"
PRINT "A. "; SHIP(1).NAYM
INPUT shipchoice%
' put input with if then here later

801 PRINT "NAVIGATOR: Choose our location (1-10)"
INPUT location%

'Players turn starts

601 CLS
PRINT "Choose an option"
PRINT "1. Fire"
PRINT "2. Move"
PRINT "3. Change Weapon"
PRINT "4. Change ship"
PRINT "5. Retreat"
INPUT action%
IF action% = 1 THEN
  GOTO 701
END IF
IF action% = 2 THEN
  GOTO 801
END IF
IF action% = 3 THEN
  GOTO 901
END IF
IF action% = 4 THEN
  GOTO 501
END IF
IF action% = 5 THEN
  GOTO 101
END IF
GOTO 601

701 CLS
PLAY "o1 l20 a"
PRINT "COMPUTER: Please enter firing coordinates (1-10)"
INPUT fire%
IF fire% = enloc% THEN
  PLAY "o1 l20 a"
  PRINT "COMPUTER: HIT DETECTED"
  PLAY "O3 L20 ABA"
  hit% = TRUE%
  ensheild% = ensheild% - WEPOWER%
  IF ensheild% <= 0 THEN
    enhull% = enhull% - WEPOWER%
    ensheild% = 0
    IF enhull% <= 0 THEN
      PRINT "j00 killed him!!! omg omg"
      END
    END IF
  END IF
ELSE
  PLAY "o1 l20 a"
  PRINT "COMPUTER: NO CONTACT DETECTED"
END IF
                          
'AI starts here

IF aleg% = 1 THEN        'Decides how the enemy ship will act
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    chncifhit% = INT(RND * 1) + 1
    chncifnhit% = INT(RND * 2) + 1
  NEXT
ELSEIF aleg% = 2 THEN
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    chncifhit% = INT(RND * 1) + 1
    chncifnhit% = INT(RND * 3) + 1
  NEXT
ELSEIF aleg% = 3 THEN
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    chncifhit% = INT(RND * 5) + 1
    chncifnhit% = INT(RND * 11) + 1
  NEXT
ELSEIF aleg% = 4 THEN
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    chncifhit% = INT(RND * 1) + 1
    chncifnhit% = INT(RND * 2) + 1
  NEXT
ELSEIF aleg% = 5 THEN
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    chncifhit% = INT(RND * 5) + 1
    chncifnhit% = INT(RND * 11) + 1
  NEXT
ELSEIF aleg% = 6 THEN
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    chncifhit% = INT(RND * 7) + 1
    chncifnhit% = INT(RND * 15) + 1
  NEXT
END IF

IF hit% = TRUE% THEN 'Enemy decides where to go if hit last turn
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    move% = INT(RND * chncifhit%) + 1
  NEXT
  hit% = false%
ELSE               'Enemy decides where to go if not hit last turn
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    move% = INT(RND * chncifnhit%) + 1
  NEXT
END IF             'If enemy has decided to move, decides where to go
IF move% = 1 THEN
  RANDOMIZE TIMER
  FOR r = 1 TO 1
    enloc% = INT(RND * 10) + 1
  NEXT
END IF

IF enhit% = TRUE% THEN   'Start enemy firing sequence
  enfireloc% = enfireloc%
ELSE
  enfireloc% = enfireloc% + 1
  IF enfireloc% > 10 THEN enfireloc% = 1
END IF
IF enfireloc% = location% THEN
  PLAY "o1 l20 a"
  PRINT "COMPUTER: WE HAVE BEEN HIT"
  PLAY "O3 L20 ABAAAA"
  enhit% = TRUE%
  SHIP(1).SHIELD = SHIP(1).SHIELD - enwepower%
  IF SHIP(1).SHIELD <= 0 THEN
    SHIP(1).HULL = SHIP(1).HULL - enwepower%
    SHIP(1).SHIELD% = 0
    IF SHIP(1).HULL% <= 0 THEN
      PRINT "Wer ded d00d. O.o"
      END
    END IF
  END IF
  GOTO 601
ELSE
  PLAY "o1 l20 a"
  PRINT "COMPUTER: ENEMY FIRE DETECTED, NO CONTACT."
  BEEP
  GOTO 601
END IF

  


'end of battle sys

121 CLS

'start option ignore

RANDOMIZE TIMER
FOR m = 1 TO 1
  hail% = INT(RND * 4) + 1
NEXT
IF hail% = 1 THEN
131 IF aleg% = 2 THEN
      PRINT "Enemy fighter is hailing, respond? (y,n)"
      INPUT hailyn$
      IF hailyn$ = "y" THEN
        PRINT "you sayed yeas"
     END IF
  END IF
  IF aleg% = 3 THEN
    PRINT "Enemy cargo ship is hailing, should we respond? (y,n)"
    INPUT hailyn$
    IF hailyn$ = "y" THEN
      PRINT "you said yes"
    END IF
  END IF
  IF aleg% = 4 THEN
    PRINT "Allied fighter is hailing, would you like to respond? (y,n)"
    INPUT hailyn$
      IF hailyn$ = "y" THEN
        PRINT "you saymd yepas"
      END IF
    END IF
  IF aleg% = 5 THEN
    PRINT "Allied cargo ship is hailing, respond?(y,n)"
    INPUT hailyn$
      IF hailyn$ = "y" THEN
        PRINT "You said yes"
      END IF
    END IF
  IF aleg% = 6 THEN
    PRINT "Peacfull cargo ship is hailing, respond?(y,n)"
    INPUT hailyn$
      IF hailyn$ = "y" THEN
        PRINT "You said yes"
      END IF
    END IF
ELSE
  END
END IF

901
401
1001
501

END SUB

SUB MAIN
CLS

'Insert intro/storyline etc... here

IF INTRO% = 1 THEN GOTO 34 'This stops it from asking yuor name after you told it once
INTRO% = 1

COLOR 7
INPUT "Hello Captain, what's your name"; NAME$
CLS
PRINT "Hello Captain "; NAME$; ", Here is your control board"
PLAY "o2 l12 aba l5 bc"
PRINT "Would you like me to show you around the ship? (y,n)"
INPUT tutorial$
IF tutorial$ = "y" THEN
TUTORIAL1
END IF

'Main control board
34 CLS
SCREEN 12
LINE (2, 2)-(600, 452), 7, B
LINE (2, 2)-(150, 200), 7, B
COLOR 12
LOCATE 2, 22
PRINT "Press the number or letter near the item you choose."
LOCATE 1, 2
COLOR 12
PRINT "NEWS FLASH"
LOCATE 2, 1
COLOR 3
PRINT "Press 'a' for news"
LINE (200, 50)-(400, 300), 14, B
LOCATE 5, 27
PRINT "1. Map"
LOCATE 20, 1
INPUT choice$
IF choice$ = "1" THEN
  MAP
ELSEIF choice$ = "a" THEN
  REDIRNEWS
ELSEIF choice$ = "poop" THEN
  PRINT "Gross!"
  PLAY "o4 l3 aa"
  GOTO 34
ELSE
  PRINT "That is not a choice"
  PLAY "o4 l3 aa"
  GOTO 34
END IF
END SUB

SUB MAP
1234 CLS

SCREEN 12
LINE (0, 20)-(680, 20)
LOCATE 1, 1
COLOR 3
PRINT "To download more info about a planet on the Arpanet, press the letter near it. "
LOCATE 20, 5
PRINT "To go back, press E"
PLAY "o6 l32 a"
LOCATE 3, 2
COLOR 3
PRINT "Earth (A)"
CIRCLE (50, 50), 3, 3
PAINT (50, 50), 3, 3
PLAY "o6 l32 a"
LOCATE 5, 7
COLOR 4
PRINT "Mars (B)"
PLAY "o6 l32 a"
CIRCLE (70, 56), 2, 4
PAINT (70, 56), 4, 4
CIRCLE (150, 150), 1, 6
PAINT (150, 150), 6, 6
CIRCLE (157, 153), 1, 6
PAINT (157, 153), 6, 6
CIRCLE (140, 140), 1, 6
PAINT (140, 140), 6, 6
CIRCLE (160, 160), 1, 6
PAINT (160, 160), 6, 6
CIRCLE (163, 163), 2, 4
PAINT (163, 163), 4, 4
CIRCLE (168, 159), 1, 6
PAINT (168, 159), 6, 6
CIRCLE (174, 170), 1, 6
PAINT (174, 170), 6, 6
CIRCLE (172, 176), 1, 6
PAINT (172, 176), 6, 6
CIRCLE (176, 172), 1, 6
PAINT (176, 172), 6, 6
COLOR 6
LOCATE 13, 12
PRINT "Asteroid Field (C)"
PLAY "o6 l32 a"
CIRCLE (170, 100), 2, 3
PAINT (170, 100), 2, 3
LOCATE 6, 15
COLOR 2
PRINT "Saturns moon, Titan (D)"
LOCATE 25, 1
INPUT planetc$
IF planetc$ = "a" THEN
        MAPEARTH
ELSEIF planetc$ = "b" THEN
        MAPMARS
ELSEIF planetc$ = "c" THEN
        MAPASTER
ELSEIF planetc$ = "d" THEN
        MAPTITAN
ELSEIF planetc$ = "e" THEN
        MAIN
ELSE
        PRINT "That is not a choice"
        PLAY "o4 l3 aa"
        GOTO 1234
END IF

END SUB

SUB MAPASTER

10000 CLS

CIRCLE (200, 200), 50, 6
PAINT (200, 200), 6, 6
PAINT (160, 200), 6, 6
CIRCLE (150, 200), 25, 6
PAINT (140, 200), 6, 6
CIRCLE (120, 130), 12, 6
PAINT (120, 130), 6, 6
CIRCLE (110, 150), 30, 6
PAINT (110, 150), 6, 6
CIRCLE (75, 20), 27, 6
PAINT (75, 20), 6, 6
CIRCLE (95, 78), 15, 6
PAINT (95, 78), 6, 6

SCREEN 12
COLOR 12
LOCATE 24, 2
PRINT "Press 1 to warp to the asteroid field"
LOCATE 27, 25
PRINT "Press 2 to go back"
LOCATE 2, 65
COLOR 2
PRINT "Asteroid Field"
LINE (639, 40)-(400, 463), 2, B
IF download = 1 THEN GOTO 20000
LOCATE 15, 60
PRINT "Downloading"
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading."
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading.. "
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading... "
PLAY "o2 l10 a"
download = 1
GOTO 10000
20000 LOCATE 4, 52
COLOR 7
30000 PRINT "A barren land of recouce fu-"
LOCATE 5, 52
PRINT "ll rocks. Inhabited by mining"
LOCATE 6, 52
PRINT "colonies. Low military acti-"
LOCATE 7, 52
PRINT "vity. Pirate citys here too."
LOCATE 11, 52
COLOR 6
PRINT "OWNER: "
LOCATE 12, 52
PRINT planet(3).OWNER
IF planet(3).OWNER = "" THEN
LOCATE 12, 52
COLOR 7
PRINT "NO OWNER ON DATABASE"
END IF
LOCATE 15, 52
COLOR 8
PRINT "NEWS:"
LOCATE 16, 52
PRINT planet(3).NEWS
IF planet(3).NEWS = "" THEN
LOCATE 16, 52
COLOR 7
PRINT "NO NEWS FILE ON DATABASE"
END IF

LOCATE 28, 1
INPUT choice$
IF choice$ = "1" THEN
WARP (3)
ELSEIF choice$ = "2" THEN
  MAP
ELSE
        PRINT "That is not a choice"
        PLAY "o4 l3 aa"
        GOTO 10000
END IF

END SUB

SUB MAPEARTH
1 CLS
SCREEN 12
CIRCLE (200, 170), 170, 2
LINE (210, 180)-(220, 190), 2
LINE (220, 190)-(250, 210), 2
LINE (250, 210)-(240, 300), 2
LINE (240, 300)-(250, 332), 2
LINE (210, 180)-(220, 130), 2
LINE (220, 130)-(320, 50), 2
PAINT (230, 140), 2, 2
LINE (66, 66)-(100, 100), 2
LINE (100, 100)-(115, 200), 2
LINE (115, 200)-(60, 270), 2
PAINT (110, 199), 2, 2
PAINT (116, 201), 1, 2
COLOR 12
LOCATE 24, 2
PRINT "Press 1 to warp to earth"
LOCATE 27, 25
PRINT "Press 2 to go back"
LOCATE 2, 65
COLOR 2
PRINT "Earth"
COLOR 7
LINE (639, 40)-(400, 463), 2, B
IF download% = 1 THEN GOTO 2
LOCATE 15, 60
PRINT "Downloading"
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading."
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading.. "
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading... "
PLAY "o2 l10 a"
download% = 1
GOTO 1
2 LOCATE 4, 52
3 PRINT "Earth, the original planet "
LOCATE 5, 52
PRINT "of humans. Emptied of resou-"
LOCATE 6, 52
PRINT "rses and scared by war, this"
LOCATE 7, 52
PRINT "planet isnt valuable except"
LOCATE 8, 52
PRINT "for it's large military st-"
LOCATE 9, 52
PRINT "rong holds and water. "
LOCATE 11, 52
COLOR 6
PRINT "OWNER: "
LOCATE 12, 52
PRINT planet(0).OWNER
IF planet(0).OWNER = "" THEN
LOCATE 12, 52
COLOR 7
PRINT "NO OWNER ON DATABASE"
END IF
LOCATE 15, 52
COLOR 8
PRINT "NEWS:"
LOCATE 16, 52
PRINT planet(0).NEWS
IF planet(0).NEWS = "" THEN
LOCATE 16, 52
COLOR 7
PRINT "NO NEWS FILE ON DATABASE"
END IF
LOCATE 28, 1
INPUT choice$
IF choice$ = "1" THEN
   WARP (0)
ELSEIF choice$ = "2" THEN
  MAP
ELSE
        PRINT "That is not a choice"
        PLAY "o4 l3 aa"
        GOTO 1
END IF

END SUB

SUB MAPMARS
100 CLS
SCREEN 12
CIRCLE (200, 170), 170, 12
PAINT (202, 172), 12, 12
CIRCLE (260, 162), 30, 0
CIRCLE (150, 150), 20, 0
CIRCLE (120, 70), 14, 0
CIRCLE (137, 200), 17, 0
CIRCLE (350, 160), 12, 0
CIRCLE (200, 270), 14, 0
COLOR 12
LOCATE 24, 2
PRINT "Press 1 to warp to Mars"
LOCATE 27, 25
PRINT "Press 2 to go back"
LOCATE 2, 65
COLOR 2
PRINT "Mars"
COLOR 7
LINE (639, 40)-(400, 463), 2, B
IF download = 1 THEN GOTO 200
LOCATE 15, 60
PRINT "Downloading"
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading."
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading.. "
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading... "
PLAY "o2 l10 a"
download = 1
GOTO 100
200 LOCATE 4, 52
300 PRINT "Mars, Earths closest neig-"
LOCATE 5, 52
PRINT "hbor. It is mostly barren "
LOCATE 6, 52
PRINT "but is valuable for it's re-"
LOCATE 7, 52
PRINT "sources not found on any ot-"
LOCATE 8, 52
PRINT "her planets except for the "
LOCATE 9, 52
PRINT "asteroid field, all metals."
LOCATE 11, 52
COLOR 6
PRINT "OWNER: "
LOCATE 12, 52
PRINT mowner$
IF eowner$ = "" THEN
LOCATE 12, 52
COLOR 7
PRINT "NO OWNER ON DATABASE"
END IF
LOCATE 15, 52
COLOR 8
PRINT "NEWS:"
LOCATE 16, 52
PRINT MNEWS$
IF MNEWS$ = "" THEN
LOCATE 16, 52
COLOR 7
PRINT "NO NEWS FILE ON DATABASE"
END IF
LOCATE 28, 1
INPUT choice$
IF choice$ = "1" THEN
  WARP (1)
ELSEIF choice$ = "2" THEN
  MAP
ELSE
        PRINT "That is not a choice"
        PLAY "o4 l3 aa"
        GOTO 100
END IF

END SUB

SUB MAPTITAN
1000 CLS
SCREEN 12
CIRCLE (200, 170), 170, 3
PAINT (202, 172), 3, 3
COLOR 12
LOCATE 24, 2
PRINT "Press 1 to warp to Titan"
LOCATE 27, 25
PRINT "Press 2 to go back"
LOCATE 2, 65
COLOR 2
PRINT "Titan"
COLOR 7
LINE (639, 40)-(400, 463), 2, B
IF download = 1 THEN GOTO 2000
LOCATE 15, 60
PRINT "Downloading"
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading."
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading.. "
PLAY "o1 l8 a"
LOCATE 15, 60
PRINT "Downloading... "
PLAY "o2 l10 a"
download = 1
GOTO 1000
2000 LOCATE 4, 52
3000 PRINT "A moon of saturn. It is"
LOCATE 5, 52
PRINT "the only planet other than"
LOCATE 6, 52
PRINT "earth that naturaly has life."
LOCATE 7, 52
PRINT "Only microrganisms and small"
LOCATE 8, 52
PRINT "Plants. Rich resources and"
LOCATE 9, 52
PRINT "future places for settelment."
LOCATE 11, 52
COLOR 6
PRINT "OWNER: "
LOCATE 12, 52
PRINT planet(2).OWNER
IF planet(2).OWNER = "" THEN
LOCATE 12, 52
COLOR 7
PRINT "NO OWNER ON DATABASE"
END IF
LOCATE 15, 52
COLOR 8
PRINT "NEWS:"
LOCATE 16, 52
PRINT planet(2).NEWS
IF planet(2).NEWS = "" THEN
LOCATE 16, 52
COLOR 7
PRINT "NO NEWS FILE ON DATABASE"
END IF
LOCATE 28, 1
INPUT choice$
IF choice$ = "1" THEN
  WARP (2)
ELSEIF choice$ = "2" THEN
  MAP
ELSE
        PRINT "That is not a choice"
        PLAY "o4 l3 aa"
        GOTO 1000
END IF

END SUB

SUB ORBITEARTH

END SUB

SUB REDIRNEWS
CLS
IF NEWS% = 1 THEN
  COLOR 7
  PRINT "The Kaban have unleashed a violent attack against The American union."
  PRINT "Over 23 civilians were killed and 47 wounded. 12 Soldiers were also"
  PRINT "killed in the fight. The American Union is asking any star captains"
  PRINT "who can help to please report to The American Unions capital city on"
  PRINT "earth. The attack happened after several succesfull AU raids on key"
  PRINT "Kaban command centers. 'We need to finish the Kaban once and for all'"
  PRINT "said a the Land Force General, Sarehm Matson."
  COLOR 4: LOCATE 25, 25: PRINT "PRESS ANY KEY TO CONTINUE"
  DO WHILE INKEY$ = ""
  LOOP
  MAIN
ELSEIF NEWS% = 2 THEN PRINT "MNEWS2"
ELSEIF NEWS% = 3 THEN PRINT "MNEWS3"
END IF
' ETC..... but each print should be replaced by a call to a sub
'similer new redirecting subs will be for enews anews tnews and mnews
END SUB

SUB TUTORIAL1
CLS
SCREEN 12
PRINT "I will show you around the ship now Captain "; NAME$; "."
PRINT "This here is your main command module. You will be here mostly."
LINE (100, 100)-(200, 200), 7, B
CIRCLE (140, 120), 15, 1
LINE (160, 130)-(160, 140), 2
LINE (160, 140)-(176, 143), 2
LINE (162, 153)-(170, 140), 5
INPUT mlmlmlmlmlml
'show up close of command module
END SUB

SUB WARP (planet%)

IF planet% = 0 THEN
  RANDOMIZE TIMER
  FOR a = 1 TO 1
  shipenc% = INT(RND * 1) + 1 ' is a 1/10 chance of encountering on earth good?
  NEXT
  IF shipenc% = 1 THEN BATTLSYS
  ELSE PRINT "poop"
END IF

IF planet% = 1 THEN
  RANDOMIZE TIMER
  FOR a = 1 TO 1
  shipenc% = INT(RND * 10) + 1
  NEXT
  IF shipenc% = 1 THEN BATTLSYS
  ELSE
    PRINT "nope"
END IF

IF planet% = 2 THEN
  RANDOMIZE TIMER
  FOR a = 1 TO 1
  shipenc% = INT(RND * 15) + 1
  NEXT
  IF shipenc% = 1 THEN BATTLSYS
  ELSE
    PRINT "nope"
END IF

IF planet% = 3 THEN
  RANDOMIZE TIMER
  FOR a = 1 TO 1
  shipenc% = INT(RND * 10) + 1
  NEXT
  IF shipenc% = 1 THEN BATTLSYS
  ELSE
    PRINT "nope"
END IF

END SUB
[/b]
-yah
Reply
#2
I don't know if you have continued with your project or not, but, today I looked at your post, up to the end of the part that I copy here:
Quote:PRINT "COMPUTER: Incoming ship detected."
PRINT ""
PRINT "1. Engage"
PRINT "2. Ignore"
PRINT "3. Hail"
INPUT choice1%
IF choice1% = 1 THEN
PLAY "o1 l20 a"
PRINT "NAVIGATOR: I'm checking the ships specs..."
PLAY "o1 l20 a p10 a p10 a"
END IF
IF choice1% = 2 THEN
GOTO 131
END IF
IF choice1% = 3 THEN
GOTO 401
END IF

IF aleg% = 1 THEN
PLAY "o1 l20 p10 a"
PRINT "NAVIGATOR: Ship confirmed as pirates! Sir!"
ELSEIF aleg% = 2 THEN

A few comments that, I hope, you will accept:

1. Instead of using INPUT, I would use INPUT$, to avoid ERROR problems with entries such as letters.

2. Instsead of using INPUT or INPUT$, I would use INKEY$, as that allows the user to simply press the 1, 2 or 3 choice, and, off he goes.

3. Immediately after the choice is detected, either by INPUT, INPUT$, or INKEY$, I would add a check to see that no other key but the allowed 1, 2, or 3 have been pressed. Something like:
Code:
IF CHOICE% < 1 OR CHOICE% > 3 THEN GOTO AGAIN:
, and I would add the label AGAIN: just after the code,
Code:
PRINT "3. Hail"

4. Unfortunately, those of us who are using Windows XP will not be able to hear your PLAY tones Sad
What do you think? Does this help you? If so, I will look at more of your code and comment on it.
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#3
Yeah that helps, thanks. Ill change around the stuff you recomended and see how it goes. Weve made some more changes since this last post, so ill post up a link to the current source code later.
-yah
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)