# Modified code

December 10 2005 at 12:02 PM

Response to Program so far

still can't get the youwin sub to come up when she gets to the cabin. Also, I'm not sure if the movement increments are right, I might have to change the length of the boat.

DECLARE FUNCTION move! (z!)
DECLARE SUB outro ()
DECLARE SUB youwin ()
DECLARE SUB pause ()
DECLARE SUB bluescrn ()
DECLARE SUB boat ()
DECLARE SUB intro ()
CLS

intro                      'Plays the introduction

pause
r = 23
c = 32

boat                       'draws the background

DO

oldc = c           'remembers the lady's location

RANDOMIZE TIMER

a = INT(RND * 2) + 1       'this equation makes a random number (either a 1 or 2)

IF a = 1 THEN
c = c + 3                 'Makes the lady go right

ELSE
c = c - 3                 'makes the lady go left

END IF

z = TIMER

DO UNTIL ABS(z - TIMER) > .25         'shows the lady for 1/4 of a second before she moves again
LOOP

LOOP UNTIL c < 11 OR c > 62

IF r <= 62 THEN 'plays ending 1
bluescrn

END IF

IF r = 16 THEN
youwin

END IF

pause

END

SUB bluescrn

COLOR 15, 1

PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "              AN EXCEPTION 0E HAS OCCURED AT YOUR LOCATION.                     "
PRINT "                                                                                "
PRINT "             ALL SPLASH-RELATED FUNCTIONALITY WILL BE TERMINATED.               "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "               FORTUNATELY, THE LADY WAS SAVED JUST IN TIME                     "
PRINT "        THANKS TO THE GLITCHY VERSION OF WINDOWS YOUR COMPUTER IS RUNNING ON.   "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "    * PRESS ANY KEY TO POWER CYCLE THE SYSTEM. IF SYSTEM DOES NOT RESTART,      "
PRINT "                                                                                "
PRINT "          SCREAM AT THE TOP OF YOUR LUNGS AND POUND ON KEYPAD.                  "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                               PRESS ANY KEY_                                   "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "
PRINT "                                                                                "

a\$ = INPUT\$(1)

END SUB

SUB boat
CLS
PRINT "b"
COLOR 14
PRINT "                      "; "*"; "              *             "; "*"
PRINT
PRINT
PRINT "        *                                                       *"
PRINT
PRINT "                                            *                             *   "; ""
PRINT
PRINT "    *"
PRINT "                 *                     *                      *"
PRINT
PRINT "*"
PRINT "         *              *                             *                 *"
PRINT
PRINT
COLOR 26
PRINT "           Cabin "
COLOR 6
PRINT "|==|                                                                "
PRINT "|  |     ħħħħħħħħ"
PRINT "|  |     ħħħħħħħħ"
PRINT "|  |     ħħħ  ħħħ"; ""
PRINT "|  |-----ħħħ  ħħħ               hit                                             "
PRINT "|  |°°°°°ħħħħħħħħ               any                                             "
PRINT "|  |°°°°°ħħħħħħħħ               key!                                           "
COLOR 8
PRINT "--------------------------------------------------------------             "
PRINT "                                                             /"
PRINT "    _    _    _    _    _    _    _    _    _    _          /"
PRINT "   | |  | |  | |  | |  | |  | |  | |  | |  | |  | |        /"
PRINT "   |_|  |_|  |_|  |_|  |_|  |_|  |_|  |_|  |_|  |_|       /"
PRINT "                                                         /"
PRINT "    _    _    _    _    _    _    _    _    _           /"
PRINT "   | |  | |  | |  | |  | |  | |  | |  | |  | |         /"
PRINT "   |_|  |_|  |_|  |_|  |_|  |_|  |_|  |_|  |_|        /"
PRINT "                                                     /"
PRINT "                                                    /"
PRINT "                                                   /"
PRINT "                                                  /"
PRINT "                                                 /"
PRINT "                                                /"
PRINT "                                               /        "
PRINT "                                              /          "
PRINT "                                             /              "
PRINT "                                            /  "
PRINT "                                           /   "
PRINT "                                          /  "
COLOR 1
PRINT "ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ"
PRINT "ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ"
PRINT "ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ"
PRINT "ħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħħ"

a\$ = INPUT\$(1)

END SUB

LOCATE r - 4, c
PRINT "         "

LOCATE r - 3, c + 2
PRINT "         "

LOCATE r - 2, c
PRINT "         "

LOCATE r - 1, c
PRINT "         "

LOCATE r, c
PRINT "         "

END SUB

SUB intro

PRINT
PRINT
PRINT "           The air is crisp on the deck of the S.S. W00ty, but one"
PRINT "                 of the passengers seems to have gotten seasick.  "
PRINT "           Unfortunately the lady seems to have stumbled her way out  "
PRINT "                 of her cabin and out onto the deck of the boat!"
PRINT "        Also, the boat doesn't have any handrails because the programmer"
PRINT "           was too lazy to put them in!!! What will become of the lady?"
PRINT "        Will she fall to her doom... or find her way back into the cabin?"
PRINT
PRINT
PRINT "                      Press any key to find out...           "

END SUB

SUB lady (r, c)                          'The parameters r and c are being passed into the sub as z,x

COLOR 2

LOCATE r - 4, c                  ' The LOCATE command tells the program where to print the lady
PRINT "      "
COLOR 6
LOCATE r - 3, c + 2
PRINT CHR\$(1)
COLOR 4
LOCATE r - 2, c
PRINT " /²-\$  "
COLOR 1
LOCATE r - 1, c
PRINT "  ²   "

LOCATE r, c
PRINT " / \  "

END SUB

FUNCTION move (z)

END FUNCTION

SUB outro

END SUB

SUB pause

a\$ = INPUT\$(1)

END SUB

SUB youwin

COLOR 25, 2

PRINT "                      CONGRATULATIONS!!! YOU WIN!!!!!"

a\$ = INPUT\$(1)

END SUB

 This message has been edited by iorr5t on Dec 10, 2005 12:21 PM

 Respond to this message
 Response Title Author and Date code... (View Thread) Haxor123 on Dec 10 Codey Haxor123 on Dec 10 fixed code Haxor123 on Dec 10 Corrected code. Recommend that you work on falling. ''''''''''=corrections. Pete on Dec 11

Newbies usually go to www.qbasic.com and click on The QBasic Forum
Forum regulars have their own ways, which include The QBasic Community Forums