'=========================================================================== ' Subject: GRAVITY SIMULATION Date: 04-18-99 (21:56) ' Author: Ross Harper Code: QB, QBasic, PDS ' Origin: t.r.harper@btinternet.com Packet: GRAPHICS.ABC '=========================================================================== '' Hullo! '' Something I wrote in days of old when knights were bold and I was bored. '' It's a thingy where you have to land the ship (you know the type). '' The space bar fires thrusters and Z/X moves the ship left/right. '' '' Ross '' Peachy512@yahoo.com '' ICQ: 15844814 '' The Zax Bypass: http://members.xoom.com/Peachy512/Asylum/home.htm DECLARE SUB pause () DECLARE SUB explode () DECLARE SUB ship (q!, a!, col!) COMMON SHARED x, y SCREEN 9 CLS : PRINT "Press key" SLEEP CLS '' Gravity=9.8 m/s^2 '' Ship travelling at 1 m/s g = 10: s = 1: x = 320: y = 20 COLOR 2: LINE (0, 300)-(640, 300) DO COLOR 7, 0: LOCATE 1, 1: PRINT "Speed "; s s = s + .1 y = y + s * g CALL ship(x, y, 5): pause: CALL ship(x, y, 0) a$ = LCASE$(INKEY$) IF a$ = "z" THEN x = x - 5 IF a$ = "x" THEN x = x + 5 IF a$ = " " THEN s = s - 1 IF y > 270 AND s <= 1 THEN BEEP: CLS : COLOR 1, 0: PRINT "You did it": END IF y > 270 AND s > 1 THEN explode: END IF y < 20 THEN y = 20 LOOP SUB explode CALL ship(x, y, 0) COLOR 5 FOR n = 1 TO 3 FOR z = 1 TO 100 PSET (INT(RND * 50) + x - 25, INT(RND * 50) + x - 25) NEXT z NEXT n BEEP END SUB SUB pause starttime = TIMER DO LOOP UNTIL TIMER <> starttime END SUB SUB ship (q, a, col) COLOR col LINE (q, a)-(q - 10, a) LINE (q - 10, a)-(q - 15, a + 5) LINE (q - 15, a + 5)-(q - 15, a + 25) LINE (q - 15, a + 25)-(q - 20, a + 25) LINE (q - 20, a + 25)-(q - 25, a + 20) LINE (q - 25, a + 20)-(q - 25, a - 20) LINE (q - 25, a - 20)-(q, a - 25) ' LINE (q, a - 25)-(q + 25, a - 20) LINE (q + 25, a - 20)-(q + 25, a + 20) LINE (q + 20, a + 25)-(q + 25, a + 20) 'line (q LINE (q + 15, a + 5)-(q + 15, a + 25) LINE (q + 15, a + 25)-(q + 20, a + 25) LINE (q + 10, a)-(q + 15, a + 5) LINE (q, a)-(q + 10, a) END SUB