'Damn the Torpedos! V 0.99 'By, Nathan 'You may NOT modify or distribute this program without my permission. 'Description: It's 1941 and your a destroyer escorting a convoy through 'the Atlantic. A sub is in the area and you have to find it. Find them 'first and sink them or you may be sunk yourself! 'Controls: Use numpad arrows left/right to move the ship. 'Press "5" to drop a depth charge. '3 Skill levels: (1) easy = 5 charges '(2) medium = 4 charges '(3) hard = 3 charges DECLARE SUB mainmenu (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, quit, dcs) DECLARE SUB submplace (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs) DECLARE SUB graphx (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs) DECLARE SUB destplace (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs, skill, victory) DECLARE SUB dropdc (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs, victory) DECLARE SUB slower () DECLARE SUB subwin (dest(), subm(), destx) SCREEN 7 CLS nummess = 15 'number of victory messages DIM dest(35, 35) 'dimmed variables DIM subm(35, 20) DIM rmess$(nummess) OPEN "vicmess.dat" FOR INPUT AS #1 'gets random victory message from file FOR count6 = 1 TO nummess INPUT #1, rmess$(count6) NEXT count6 CLOSE #1 DO UNTIL quit = 1 'the program CALL mainmenu(subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, quit, dcs) LOOP END SUB destplace (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs, skill, victory) destx = 160 destY = 69 PUT (160, 69), dest, XOR SELECT CASE skill CASE 1 'changes charge count for skill dcs = 5 CASE 2 dcs = 4 CASE 3 dcs = 3 END SELECT DO UNTIL dcs = 0 OR victory = 1 SELECT CASE INKEY$ 'controls of the game CASE CHR$(54) IF destx < 259 THEN destx = destx + 1 PUT (destx, destY), dest, XOR PUT (destx - 1, destY), dest CASE CHR$(52) IF destx > 0 THEN destx = destx - 1 PUT (destx, destY), dest, XOR PUT (destx + 1, destY), dest CASE CHR$(53) CALL dropdc(subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs, victory) END SELECT LOOP IF dcs = 0 AND victory = 0 THEN 'determines victory or defeat CALL subwin(dest(), subm(), destx) END IF END SUB SUB dropdc (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs, victory) DO UNTIL depth > 9 AND depth < 101 LOCATE 1, 1 COLOR 4 PRINT "Charges remaining:"; dcs COLOR 1 INPUT "How deep (as low as 5 and up to 100)"; depth 'drops charge LINE (0, 0)-(320, 50), 0, BF LOOP dcx = destx dcy = destY + 21 DO UNTIL dcy = 100 PSET (dcx, dcy), 0 dcy = dcy + 1 PSET (dcx, dcy), 4 CALL slower LOOP tdepth = depth + dcy DO UNTIL dcy = tdepth PSET (dcx, dcy), 1 dcy = dcy + 1 PSET (dcx, dcy), 4 CALL slower LOOP dcs = dcs - 1 radii = 1 'explosion, kept on screen so you know where you dropped it DO UNTIL radii = 15 CIRCLE (dcx, dcy), radii, 4 PAINT (dcx, dcy), 4 CALL slower radii = radii + 1 LOOP LINE (0, 0)-(320, 60), 0, BF LOCATE 1, 1 'determines whether it is a hit or miss IF subx > dcx - 15 AND subx < dcx + 15 AND suby > dcy - 15 AND suby < dcy + 15 THEN rmess = INT(RND * 5 + 1) PRINT rmess$(rmess) victory = 1 exprad = 1 DO UNTIL exprad = 12 CIRCLE (subx, suby), exprad, 8 exprad = exprad + 1 LOOP PRINT "Press any key to continue." DO WHILE INKEY$ = "" LOOP ELSE PRINT "Missed!"; IF subx > dcx + 15 THEN PRINT "I hear something to the right!" 'kept short so it doesn't crop on the screen IF subx < dcx - 15 THEN PRINT "I hear something to the left!" IF suby < dcy - 15 THEN PRINT "Probably too shallow!" IF suby > dcy + 15 THEN PRINT "Probably too shallow!" END IF END SUB SUB graphx (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs) CLS LINE (50, 50)-(80, 60), 8, BF 'destroyer grafx LINE (80, 60)-(100, 50), 8 LINE (100, 50)-(50, 50), 8 PAINT (81, 51), 8 LINE (50, 50)-(40, 50), 8 LINE (50, 60)-(40, 50), 8 PAINT (45, 52), 8 LINE (65, 50)-(55, 40), 8, BF LINE (68, 40)-(52, 35), 8, BF LINE (62, 35)-(58, 30), 8, BF LINE (75, 50)-(85, 45), 8, BF LINE (85, 47)-(92, 47), 8 FOR x = 53 TO 67 STEP 2 PSET (x, 36), 14 NEXT x GET (40, 30)-(100, 60), dest CLS LINE (50, 50)-(90, 50), 8 'sub grafx LINE (50, 50)-(55, 45), 8 LINE (55, 45)-(75, 45), 8 LINE (75, 45)-(90, 50), 8 LINE (60, 45)-(65, 40), 8, BF LINE (59, 40)-(66, 38), 8, BF PAINT (60, 49), 8 FOR tankx = 57 TO 67 STEP 2 PSET (tankx, 49), 0 NEXT tankx GET (50, 38)-(90, 50), subm CLS LINE (0, 100)-(320, 200), 1, BF 'the water, fills exactly half the screen END SUB SUB mainmenu (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, quit, dcs) CLS CIRCLE (160, 100), 100, 2 'green crosshair, ship, water, sky, etc. LINE (62, 115)-(258, 115), 2 PAINT (65, 117), 1, 2 PAINT (65, 95), 9, 2 LINE (62, 115)-(258, 115), 1 LINE (110, 95)-(180, 115), 8, BF LINE (100, 95)-(110, 95), 8 LINE (100, 95)-(110, 115), 8 PAINT (105, 103), 8 LINE (205, 95)-(180, 95), 8 LINE (205, 95)-(180, 115), 8 PAINT (190, 100), 8 LINE (125, 100)-(135, 80), 8, BF LINE (123, 80)-(137, 75), 8, BF LINE (145, 100)-(155, 85), 8, BF LINE (165, 95)-(180, 90), 8, BF LINE (180, 92)-(188, 92), 8 LINE (60, 100)-(260, 100), 0 'changes the crosshair colors to black, originally green LINE (160, 17)-(160, 183), 0 CIRCLE (160, 100), 100, 0 LOCATE 2, 9 COLOR 1 PRINT "Damn the Torpedoes! V 0.99" DO WHILE INKEY$ = "" LOOP CLS 'main menu DO UNTIL ch1 = 1 OR quit = 1 CLS LOCATE 9, 10 COLOR 4 PRINT "Main Menu" COLOR 1 LOCATE 10, 10 PRINT "1) Play Game" LOCATE 11, 10 PRINT "2) View Controls" LOCATE 12, 10 PRINT "3) Quit" LOCATE 13, 10 INPUT " "; ch1 SELECT CASE ch1 'starting the game... CASE 1 DO UNTIL skill = 1 OR skill = 2 OR skill = 3 INPUT "What skill"; skill LOOP CALL graphx(subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs) CALL submplace(subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs) CALL destplace(subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs, skill, victory) CASE 2 'printing the controls... CLS PRINT "Use the numpad left/right arrows to move and the number 5 to drop charges." PRINT " " PRINT "You have limited charges so use them" PRINT "wisely." PRINT " " PRINT "(1) Easy = 5 charges" PRINT "(2) Medium = 4 charges" PRINT "(3) Hard = 3 charges" COLOR 4 PRINT "Press any key to continue." COLOR 1 DO WHILE INKEY$ = "" LOOP CASE 3 'quitting the game... quit = 1 CASE ELSE 'just in case PRINT "Not a valid selection." END SELECT LOOP END SUB SUB slower FOR x = 1 TO 10000 'slows things down NEXT x END SUB SUB submplace (subm(), dest(), rmess$(), subx, suby, destx, destY, dcx, dcy, dcs) RANDOMIZE TIMER subx = INT(RND * 260) 'MUST be 260 so the destroyer can reach it suby = INT(RND * 100 + 100) END SUB SUB subwin (dest(), subm(), destx) LINE (0, 100)-(320, 200), 1, BF 'removes explosions diff = destx - 20 'rearranges destroyer position destx = 20 PUT (destx, 69), dest, XOR PUT (destx + diff, 69), dest torpath = destx + 160 PUT (torpath, 87), subm DO UNTIL torpath = destx + 40 'here comes the torpedo PSET (torpath, 100), 4 PSET (torpath + 1, 100), 1 torpath = torpath - 1 CALL slower LOOP radii2 = 1 'ouch! DO UNTIL radii2 = 25 CIRCLE (torpath, 101), radii2, 4 radii2 = radii2 + 1 CALL slower LOOP COLOR 4 'game over message PRINT "Game Over. Press any key to continue." DO WHILE INKEY$ = "" LOOP COLOR 1 END SUB