Author Topic: Re: Daring Dan in 'Math Climber'  (Read 549 times)

0 Members and 1 Guest are viewing this topic.

FellippeHeitor

  • Guest
Re: Daring Dan in 'Math Climber'
« on: January 14, 2020, 10:00:11 am »
Yes, Linux has issues with sound in QB64.  I am glad it is working for you.

Already fixed in dev builds.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Daring Dan in 'Math Climber'
« Reply #1 on: January 14, 2020, 01:59:20 pm »
  • Best Answer
  • I had a TI99 4A, but I don't remember FRED. That's OK though. At my age, I don't remember other 4-letter words, either. Well, I like it. Nice happy dance when Dan gets to the top, but lacking some excitement when a wrong answer is input. I'd rather see Dan fall on his ascii, instead of just climbing down.

    Also, I showed your game to my good friend Donald J. Trump. He asked  me to make to following improvements...

    Code: QB64: [Select]
    1. _TITLE "Math Climber"
    2.  
    3. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    4. '   Game based on FRED for the TI99/4a computer
    5. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    6.  
    7. CONST False = 0
    8. CONST True = -1
    9.  
    10. TYPE Math
    11.     ans AS SINGLE
    12.     sym AS INTEGER
    13.     exp1 AS INTEGER
    14.     exp2 AS INTEGER
    15.  
    16.     side AS _BYTE
    17.  
    18. DIM SHARED Math AS Math
    19.  
    20. DIM SHARED WellDone AS LONG
    21.  
    22. Limit = 30
    23.  
    24.  
    25. zoom = 3
    26.  
    27.  
    28. DIM SHARED Sprite(64) AS LONG
    29.  
    30.  
    31. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    32. '   The object of this game is to solve math problems and try to get your
    33. '   character to the top of the wall.  Can you do it?
    34. '
    35. '   Changes from original:
    36. '   Different colors and graphics
    37. '   Climber cllimbs up the middle of the wall instead of on the side
    38. '   Added Subtraction, Multiplication, and Division
    39. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    40.  
    41. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    42. '   Increase Zoom to enlarge the screen
    43. '   For people like me who are blind in one eye while not able to see out of the other
    44. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    45.  
    46. Mag = 8 * zoom
    47. xScreen = 128 * zoom
    48. yScreen = 96 * zoom
    49. SCREEN _NEWIMAGE(xScreen, yScreen, 32)
    50.  
    51. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    52. '   Load Colors and Graphics
    53. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    54. Loader
    55.  
    56. ' \/\/\/\/\/\/\/\/\/\/\/
    57. '   Introduction Text
    58. ' /\/\/\/\/\/\/\/\/\/\/\
    59. Intro
    60.  
    61. ' \/\/\/\/\/\/\/\/\/\/\/
    62. '   Main Program Loop
    63. ' /\/\/\/\/\/\/\/\/\/\/\
    64. Main
    65.  
    66. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    67. '   Game Over - Play Again?
    68. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    69. GameOver -1
    70.  
    71. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    72. '   Convert Decimal to Binary
    73. '   Length limits the length of the binary value returned
    74. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    75. FUNCTION BinValue$ (Value AS INTEGER, Length AS INTEGER)
    76.     DIM temp AS STRING
    77.  
    78.     WHILE Value <> 0
    79.         temp = RIGHT$(STR$(Value MOD 2), 1) + temp
    80.         Value = Value \ 2
    81.     WEND
    82.  
    83.     BinValue = RIGHT$(STRING$(Length, 48) + temp, Length)
    84.  
    85. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    86. '   Load Colors and Graphics
    87. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    88. SUB Loader
    89.     ' \/\/\/\/\/\/\/
    90.     '   Medium Red
    91.     ' /\/\/\/\/\/\/\
    92.     Red = _RGB32(252, 85, 84)
    93.  
    94.     ' \/\/\/\/\/\/\/
    95.     '   Dark Blue
    96.     ' /\/\/\/\/\/\/\
    97.     Blue = _RGB32(84, 85, 237)
    98.  
    99.     ' \/\/\/\/
    100.     '   Cyan
    101.     ' /\/\/\/\
    102.     Cyan = _RGB32(66, 235, 245)
    103.  
    104.     ' \/\/\/\/\/
    105.     '   Black
    106.     ' /\/\/\/\/\
    107.     Black = _RGB(0, 0, 0)
    108.  
    109.     ' \/\/\/\/\/
    110.     '   White
    111.     ' /\/\/\/\/\
    112.     White = _RGB32(255, 255, 255)
    113.  
    114.     ' \/\/\/\/\/
    115.     '   Yellow
    116.     ' /\/\/\/\/\
    117.     Yellow = _RGB32(230, 206, 128)
    118.  
    119.     ' \/\/\/\/\/
    120.     ' Magenta
    121.     ' /\/\/\/\/\
    122.     Magenta = _RGB32(201, 91, 186)
    123.  
    124.     ' \/\/\/\/\/\/\/\/\/\/
    125.     '   Happy/Sad Faces
    126.     ' /\/\/\/\/\/\/\/\/\/\
    127.     CallChar 1, "3C7EDBFFFFDB663C", Yellow, White
    128.     CallChar 2, "3C7EDBFFFFE75A3C", Yellow, White
    129.     CallChar 3, "C3812400002499C3", Yellow, White
    130.     CallChar 4, "C38124000018A5C3", Yellow, White
    131.  
    132.     ' \/\/\/\/\/\/\/\/\/\/\/\/\/
    133.     '   Make Faces transparent
    134.     ' /\/\/\/\/\/\/\/\/\/\/\/\/\
    135.     FOR i = 1 TO 4
    136.         _CLEARCOLOR White, Sprite(i)
    137.     NEXT
    138.  
    139.     ' \/\/\/\/\/\/
    140.     '   Climber
    141.     ' /\/\/\/\/\/\
    142.     CallChar 5, "3838107C1038286C", Cyan, White
    143.     CallChar 6, "3838927C10382C60", Cyan, White
    144.     CallChar 7, "3838927C1038680C", Cyan, White
    145.  
    146.     ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    147.     '   Make Climber transparent
    148.     ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    149.     FOR i = 5 TO 7
    150.         _CLEARCOLOR White, Sprite(i)
    151.     NEXT
    152.  
    153.     ' \/\/\/\/\/\/\/
    154.     '   Brick Wall
    155.     ' /\/\/\/\/\/\/\
    156.     CallChar 8, "7FFF92FFA4FF92FF", Black, Red
    157.     CallChar 9, "FFFF49FF92FF49FF", Black, Red
    158.     CallChar 10, "FEFF25FF49FF25FF", Black, Red
    159.  
    160.     CallChar 11, "A4FF92FFA4FF92FF", Black, Red
    161.     CallChar 12, "92FF49FF92FF49FF", Black, Red
    162.     CallChar 13, "49FF25FF49FF25FF", Black, Red
    163.  
    164.     ' \/\/\/\/\/\/\/\/\/\/\/
    165.     '   Numbers ( 0 - 9 )
    166.     ' /\/\/\/\/\/\/\/\/\/\/\
    167.     CallChar 14, "0038444444444438", Black, Blue
    168.     CallChar 15, "0010301010101038", Black, Blue
    169.     CallChar 16, "003844040810207C", Black, Blue
    170.     CallChar 17, "0038440418044438", Black, Blue
    171.     CallChar 18, "00081828487C0808", Black, Blue
    172.     CallChar 19, "007C407804044438", Black, Blue
    173.     CallChar 20, "0018204078444438", Black, Blue
    174.     CallChar 21, "007C040810202020", Black, Blue
    175.     CallChar 22, "0038444438444438", Black, Blue
    176.     CallChar 23, "003844443C040830", Black, Blue
    177.  
    178.     ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    179.     '   Math Symbols ( + - * / . )
    180.     ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    181.     CallChar 24, "000010107C101000", Black, Blue
    182.     CallChar 25, "000000007C000000", Black, Blue
    183.     CallChar 26, "0000221408142200", Black, Blue
    184.     CallChar 27, "1818007E7E001818", Black, Blue
    185.     CallChar 28, "0000000000003030", Black, Blue
    186.     CallChar 29, "000000000000007C", Black, Blue
    187.  
    188.     ' \/\/\/\/\/\/\/\/\/\/\/
    189.     '   Letters ( A - Z )
    190.     ' /\/\/\/\/\/\/\/\/\/\/\
    191.     CallChar 30, "003844447C444444", Black, Blue
    192.     CallChar 31, "0078242438242478", Black, Blue
    193.     CallChar 32, "0038444040404438", Black, Blue
    194.     CallChar 33, "0078242424242478", Black, Blue
    195.     CallChar 34, "007C40407840407C", Black, Blue
    196.     CallChar 35, "007C404078404040", Black, Blue
    197.     CallChar 36, "003C40405C444438", Black, Blue
    198.     CallChar 37, "004444447C444444", Black, Blue
    199.     CallChar 38, "0038101010101038", Black, Blue
    200.     CallChar 39, "0004040404044438", Black, Blue
    201.     CallChar 40, "0044485060504844", Black, Blue
    202.     CallChar 41, "004040404040407C", Black, Blue
    203.     CallChar 42, "00446C5454444444", Black, Blue
    204.     CallChar 43, "00446464544C4C44", Black, Blue
    205.     CallChar 44, "007C44444444447C", Black, Blue
    206.     CallChar 45, "0078444478404040", Black, Blue
    207.     CallChar 46, "0038444444544834", Black, Blue
    208.     CallChar 47, "0078444478504844", Black, Blue
    209.     CallChar 48, "0038444038044438", Black, Blue
    210.     CallChar 49, "007C101010101010", Black, Blue
    211.     CallChar 50, "0044444444444438", Black, Blue
    212.     CallChar 51, "0044444428281010", Black, Blue
    213.     CallChar 52, "0044444454545428", Black, Blue
    214.     CallChar 53, "0044442810284444", Black, Blue
    215.     CallChar 54, "0044442810101010", Black, Blue
    216.     CallChar 55, "007C04081020407C", Black, Blue
    217.  
    218.     ' \/\/\/\/\/\/\/\/\/\/\/
    219.     '   Symbols ( , ' ? )
    220.     ' /\/\/\/\/\/\/\/\/\/\/\
    221.     CallChar 56, "0000000000301020", Black, Blue
    222.     CallChar 57, "0008081000000000", Black, Blue
    223.     CallChar 58, "0038440408100010", Black, Blue
    224.  
    225.     CallChar 64, "007C7C7C7C7C7C7C", Black, Black
    226.  
    227.     IF _FILEEXISTS("UhOh.mp3") THEN
    228.         UhOh = _SNDOPEN("UhOh.mp3")
    229.     END IF
    230.  
    231.     IF _FILEEXISTS("WellDone.mp3") THEN
    232.         WellDone = _SNDOPEN("WellDone.mp3")
    233.     END IF
    234.  
    235. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    236. '   ( Character Definition )
    237. '   CALL CHAR (char-code, "pattern-identifier")
    238. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    239. SUB CallChar (Char AS INTEGER, Code AS STRING, Fore AS _UNSIGNED LONG, Back AS _UNSIGNED LONG)
    240.     DIM temp AS STRING
    241.  
    242.     Sprite(Char) = _NEWIMAGE(8, 8, 32)
    243.     _DEST Sprite(Char)
    244.  
    245.     FOR v = 0 TO 7
    246.         temp = BinValue(VAL("&H" + MID$(Code, 2 * v + 1, 2)), 8)
    247.  
    248.         FOR h = 0 TO 7
    249.             IF MID$(temp, h + 1, 1) = "0" THEN
    250.                 PSET (h, v), Back
    251.             ELSE
    252.                 PSET (h, v), Fore
    253.             END IF
    254.         NEXT
    255.     NEXT
    256.  
    257.     _DEST 0
    258.  
    259. FUNCTION CharInput$ (Row AS INTEGER, Col AS INTEGER)
    260.     DIM touch AS STRING
    261.  
    262.     Cursor = True
    263.     WHILE INKEY$ <> "": WEND
    264.  
    265.     x1 = Mag * Col - 1: x2 = x1 + Mag - 1
    266.     y1 = Mag * Row - 1: y2 = y1 + Mag - 1
    267.  
    268.     WHILE NOT Done
    269.         _LIMIT 60
    270.  
    271.         touch = INKEY$
    272.         IF touch <> "" THEN
    273.             IF touch = CHR$(8) THEN Done = True
    274.             IF touch = CHR$(13) OR touch = " " THEN Done = True
    275.  
    276.             IF INSTR("0123456789-.", touch) THEN Done = True
    277.         END IF
    278.  
    279.         IF Frames = 0 THEN
    280.             LINE (x1, y1)-(x2, y2), Blue, BF
    281.  
    282.             IF Cursor THEN
    283.                 Cursor = False
    284.                 _PUTIMAGE (x1, y1)-(x2, y2), Sprite(1)
    285.             ELSE
    286.                 Cursor = True
    287.                 _PUTIMAGE (x1, y1)-(x2, y2), Sprite(3)
    288.             END IF
    289.  
    290.             _DISPLAY
    291.         END IF
    292.  
    293.         Frames = Frames + 1
    294.         IF Frames = Limit THEN Frames = 0
    295.     WEND
    296.  
    297.     CharInput = touch
    298.  
    299. SUB Intro
    300.     DIM touch AS STRING
    301.  
    302.     IF zoom = 3 THEN
    303.         text = "  Daring Dan likes to climb, and he has the challenge of climbing up a tall"
    304.         text = text + " brick wall." + SPACE$(28) + " Can you help him?"
    305.         text = text + SPACE$(30) + " Every right answer to a math question will help"
    306.         text = text + " him get higher on the wall and closer to his goal."
    307.         WordWrap text: touch = CharInput(11, 15)
    308.  
    309.         text = "  Watch out, though, one wrong answer and poor 'ole Dan will fall to the"
    310.         text = text + " ground." + SPACE$(34)
    311.         text = text + "  Don't worry, Dan will survive the fall and you can try again."
    312.         WordWrap text: touch = CharInput(11, 15)
    313.  
    314.         text = "  Do you want to?" + SPACE$(32)
    315.         text = text + " 1. Easy Numbers" + SPACE$(12) + "* 1, 2, 3 *" + SPACE$(34)
    316.         text = text + "2. Advanced Numbers        * 1.2, 2.4, 3.6 *"
    317.         WordWrap text
    318.     ELSE
    319.         text = "  Daring Dan likes to climb, and he has the challenge of climbing up a tall"
    320.         text = text + " brick wall." + SPACE$(36) + "Can you help him?" + SPACE$(46)
    321.         text = text + " Every right answer to a math question will help him get higher on"
    322.         text = text + " the wall and closer to his goal." + SPACE$(52)
    323.         text = text + "  Watch out, though, one wrong answer and poor 'ole Dan will fall to the"
    324.         text = text + " ground." + SPACE$(46)
    325.         text = text + " Don't worry, Dan will survive the fall and you can try again."
    326.         WordWrap text: touch = CharInput(11, 15)
    327.  
    328.         text = "  Do you want to?" + SPACE$(32)
    329.         text = text + " 1. Easy Numbers" + SPACE$(12) + "* 1, 2, 3 *" + SPACE$(34)
    330.         text = text + "2. Advanced Numbers        * 1.2, 2.4, 3.6 *"
    331.         WordWrap text
    332.     END IF
    333.  
    334.     Done = False
    335.     WHILE NOT Done
    336.         Level = CharInput(11, 15)
    337.         IF Level = "1" OR Level = "2" THEN Done = True
    338.     WEND
    339.  
    340. SUB WordWrap (text AS STRING)
    341.     LINE (0, 0)-(xScreen - 1, yScreen - 1), Blue, BF
    342.     GameTitle -1
    343.  
    344.     IF zoom = 2 THEN Mag = 8: Row = 5
    345.     IF zoom = 3 THEN Mag = 16: Row = 4
    346.     IF zoom > 3 THEN Mag = 16: Row = 5
    347.  
    348.     length = xScreen \ Mag
    349.     WHILE LEN(text) > length
    350.         t = length
    351.         WHILE MID$(text, t, 1) <> " ": t = t - 1: WEND
    352.         CharPrint Row, 0, LEFT$(text, t), 0
    353.  
    354.         Row = Row + 1
    355.         text = RIGHT$(text, LEN(text) - t)
    356.     WEND
    357.  
    358.     CharPrint Row, 0, text, 0
    359.  
    360.     Mag = 8 * zoom
    361.  
    362. SUB GameTitle (Flag AS INTEGER)
    363.     DIM text AS STRING
    364.  
    365.     Mag = 8 * zoom
    366.  
    367.     text = "Math Climber"
    368.     CharPrint 0, 0, text, -1
    369.  
    370.     IF Flag THEN
    371.         text = "by [banned user]"
    372.         CharPrint 1, 0, text, -1
    373.     END IF
    374.  
    375. SUB Background
    376.     DIM text AS STRING
    377.  
    378.     LINE (0, 0)-(xScreen - 1, yScreen - 1), Blue, BF
    379.  
    380.     'text = "The Wall of Math"
    381.     'CharPrint 0, 0, text, -1
    382.     text = "TRUMP'S WALL"
    383.     CharPrint 0, 0, text, -1
    384.     y1 = Mag * 2: y2 = y1 + Mag - 1
    385.     x1 = xScreen \ 2 - 21: x2 = x1 + Mag - 1
    386.  
    387.     _PUTIMAGE (x1, y1)-(x2, y2), Sprite(8)
    388.     _PUTIMAGE (x1 + 8, y1)-(x2 + 8, y2), Sprite(9)
    389.     _PUTIMAGE (x1 + 16, y1)-(x2 + 16, y2), Sprite(10)
    390.  
    391.     FOR v = 3 TO 21
    392.         y1 = Mag * v: y2 = y1 + Mag - 1
    393.  
    394.         _PUTIMAGE (x1, y1)-(x2, y2), Sprite(11)
    395.         _PUTIMAGE (x1 + 8, y1)-(x2 + 8, y2), Sprite(12)
    396.         _PUTIMAGE (x1 + 16, y1)-(x2 + 16, y2), Sprite(13)
    397.     NEXT
    398.  
    399. ' \/\/\/\/\/\/\/\/\/\/\/\/\/\/
    400. '   Print text to the screen
    401. ' /\/\/\/\/\/\/\/\/\/\/\/\/\/\
    402. SUB CharPrint (row AS INTEGER, col AS INTEGER, text AS STRING, flag AS _BYTE)
    403.     DIM temp AS STRING
    404.  
    405.     IF flag = -1 THEN col = 8 - LEN(text) \ 2
    406.  
    407.     text = UCASE$(text)
    408.     y1 = Mag * row: y2 = y1 + Mag - 1
    409.     temp = "0123456789+-*/._ABCDEFGHIJKLMNOPQRSTUVWXYZ,'?"
    410.  
    411.     FOR c = 0 TO LEN(text) - 1
    412.         f = INSTR(temp, MID$(text, c + 1, 1))
    413.  
    414.         IF f > 0 THEN
    415.             x1 = Mag * (col + c): x2 = x1 + Mag - 1
    416.             _PUTIMAGE (x1, y1)-(x2, y2), Sprite(13 + f)
    417.         END IF
    418.     NEXT
    419.  
    420. SUB MathProblem
    421.     DIM Ans AS STRING
    422.     DIM Exp1 AS STRING
    423.     DIM Exp2 AS STRING
    424.     DIM temp AS STRING
    425.     DIM touch AS STRING
    426.  
    427.     Math.sym = INT(4 * RND) + 1
    428.     temp = MID$("+-*/", Math.sym, 1)
    429.  
    430.     WHILE NOT Ready
    431.         Math.exp1 = INT(11 * RND)
    432.         Math.exp2 = INT(11 * RND)
    433.  
    434.         IF Math.sym = 4 THEN
    435.             IF Math.exp1 = 0 THEN Math.exp1 = INT(10 * RND) + 1
    436.             IF Math.exp2 = 0 THEN Math.exp2 = INT(10 * RND) + 1
    437.  
    438.             IF Level = "1" THEN
    439.                 IF Math.exp1 / Math.exp2 <> Math.exp1 \ Math.exp2 THEN
    440.                     WHILE NOT Safe
    441.                         Math.exp1 = INT(10 * RND) + 1
    442.                         Math.exp2 = INT(10 * RND) + 1
    443.  
    444.                         IF Math.exp1 / Math.exp2 = Math.exp1 \ Math.exp2 THEN Safe = -1
    445.                     WEND
    446.                 END IF
    447.             END IF
    448.         END IF
    449.  
    450.         SELECT CASE Math.sym
    451.             CASE 1: Math.ans = Math.exp1 + Math.exp2
    452.             CASE 2: Math.ans = Math.exp1 - Math.exp2
    453.             CASE 3: Math.ans = Math.exp1 * Math.exp2
    454.             CASE 4: Math.ans = Math.exp1 / Math.exp2
    455.         END SELECT
    456.  
    457.         Ready = -1
    458.     WEND
    459.  
    460.     IF Math.exp1 = 10 THEN
    461.         Exp1 = _TRIM$(STR$(Math.exp1))
    462.     ELSE
    463.         Exp1 = STR$(Math.exp1)
    464.     END IF
    465.  
    466.     IF Math.exp2 = 10 THEN
    467.         Exp2 = temp + _TRIM$(STR$(Math.exp2)): ea2 = LEN(Exp2)
    468.     ELSE
    469.         Exp2 = temp + STR$(Math.exp2)
    470.     END IF
    471.  
    472.     ea1 = LEN(Exp1): ea2 = LEN(Exp2)
    473.  
    474.     Ans = _TRIM$(STR$(Math.ans)): sa = LEN(Ans)
    475.     IF sa > 4 THEN Ans = LEFT$(Ans, 4): sa = 4
    476.  
    477.     IF Math.side = 0 THEN x = 5 ELSE x = 14
    478.  
    479.     CharPrint 2, x - ea1, Exp1, 0
    480.     CharPrint 3, x - ea2, Exp2, 0
    481.     CharPrint 4, x - 4, STRING$(5, "_"), 0
    482.     CharPrint 5, x - sa, STRING$(sa, "?"), 0
    483.  
    484.     temp = ""
    485.     WHILE sa <> 0
    486.         touch = CharInput(11, 15)
    487.  
    488.         IF touch = CHR$(8) THEN
    489.             temp = "": sa = LEN(Math.ans)
    490.             CharPrint 5, x - sa, STRING$(sa, "?"), 0
    491.         ELSE
    492.             CharPrint 5, x - sa, touch, 0
    493.             _DISPLAY
    494.             _DELAY 0.25
    495.  
    496.             temp = temp + touch: sa = sa - 1
    497.         END IF
    498.     WEND
    499.  
    500.     IF VAL(temp) = Math.ans THEN Climb ELSE Fall
    501.  
    502. SUB Climb
    503.     IF WellDone THEN _SNDPLAY WellDone
    504.  
    505.     Background
    506.     yClimb = yClimb - Mag \ 2
    507.  
    508.     IF uClimb = 0 THEN
    509.         _PUTIMAGE (xClimb, yClimb)-(xClimb + Mag - 1, yClimb + Mag - 1), Sprite(6)
    510.     ELSE
    511.         _PUTIMAGE (xClimb, yClimb)-(xClimb + Mag - 1, yClimb + Mag - 1), Sprite(7)
    512.     END IF
    513.  
    514.     _DISPLAY
    515.     _DELAY 0.25
    516.  
    517.     Background
    518.     yClimb = yClimb - Mag \ 2
    519.     _PUTIMAGE (xClimb, yClimb)-(xClimb + Mag - 1, yClimb + Mag - 1), Sprite(5)
    520.     _DISPLAY
    521.     _DELAY 0.25
    522.  
    523.     uClimb = (uClimb + 1) MOD 2
    524.  
    525. SUB HappyDance
    526.     IF WellDone THEN _SNDPLAY WellDone
    527.  
    528.     FOR dance = 0 TO 11
    529.         Background
    530.         IF dance MOD 2 = 0 THEN
    531.             _PUTIMAGE (xClimb, yClimb)-(xClimb + Mag - 1, yClimb + Mag - 1), Sprite(6)
    532.         ELSE
    533.             _PUTIMAGE (xClimb, yClimb)-(xClimb + Mag - 1, yClimb + Mag - 1), Sprite(7)
    534.         END IF
    535.  
    536.         _DISPLAY
    537.         _DELAY 0.15
    538.  
    539.         Background
    540.         _PUTIMAGE (xClimb, yClimb)-(xClimb + Mag - 1, yClimb + Mag - 1), Sprite(5)
    541.         _DISPLAY
    542.         _DELAY 0.15
    543.     NEXT
    544.  
    545. SUB Fall
    546.     IF UhOh THEN _SNDPLAY UhOh
    547.  
    548.     FOR y = yClimb TO 20 * Mag STEP 3
    549.         Background
    550.         'IF y MOD 2 = 0 THEN
    551.         _PUTIMAGE (xClimb, y)-(xClimb + Mag - 1, y + Mag - 1), Sprite(6)
    552.         'ELSE
    553.         '_PUTIMAGE (xClimb, y)-(xClimb + Mag - 1, y + Mag - 1), Sprite(7)
    554.         'END IF
    555.         _PUTIMAGE (xClimb, y)-(xClimb + Mag - 1, y + Mag - 1), Sprite(7)
    556.         _DISPLAY
    557.         _DELAY 0.005
    558.     NEXT
    559.     text = "BOOM"
    560.     _DELAY .25
    561.     CharPrint 18, 6, text, 0
    562.     _DISPLAY
    563.     _DELAY 3
    564.     GameOver 0
    565.  
    566. SUB Main
    567.     yScreen = 156 * zoom
    568.     SCREEN _NEWIMAGE(xScreen, yScreen, 32)
    569.  
    570.     yClimb = 11 * Mag
    571.     xClimb = xScreen \ 2 - 12
    572.     Math.side = INT(2 * RND)
    573.  
    574.     WHILE NOT Done
    575.         WHILE yClimb <> 24
    576.             _LIMIT 60
    577.  
    578.             Background
    579.             _PUTIMAGE (xClimb, yClimb)-(xClimb + Mag - 1, yClimb + Mag - 1), Sprite(5)
    580.             _DISPLAY
    581.  
    582.             MathProblem
    583.         WEND
    584.  
    585.         HappyDance
    586.         Done = True
    587.     WEND
    588.  
    589. SUB GameOver (Flag AS SINGLE)
    590.     DIM text AS STRING
    591.     DIM touch AS STRING
    592.  
    593.     IF Flag THEN
    594.         text = "  Congratulations.  You helped that daring Dan make it to the to of the Wall of Math."
    595.         text = text + SPACE$(32) + " Would you like to play again?" + SPACE$(38) + " 1. Yes        2. No"
    596.     ELSE
    597.         text = "  Awe,  You tried, but failed to help daring Dan make it to the top.   Don't be sad though."
    598.         text = text + SPACE$(26) + "  Would you like to play again?" + SPACE$(38) + " 1. Yes        2. No"
    599.     END IF
    600.  
    601.     LINE (0, 0)-(xScreen - 1, yScreen - 1), Blue, BF
    602.     GameTitle -1
    603.     WordWrap text
    604.  
    605.     touch = CharInput(12, 15)
    606.     IF touch = "1" THEN Main ELSE SYSTEM
    607.  

    Pete :D
    Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/