'=========================================================================== ' Subject: BOUNCING TRIANGLE Date: 10-24-99 (09:33) ' Author: Michael Galos Code: QB, QBasic, PDS ' Origin: galvin@powerup.com.au Packet: GRAPHICS.ABC '=========================================================================== 'By Michael Galos 'This is a bouncing triange program that I made years ago 'It's pretty simple and was one of my first programs ever. SCREEN 13 pi = 3.141592654# / 180 s = 3000 r = 15 a = 160 b = 100 c = 32 d = 1 e = 1 1 FOR i = 1 TO 360 x1 = a + r * SIN(pi * i) y1 = b + r * COS(pi * i) x2 = a + r * SIN(pi * (i + 120)) y2 = b + r * COS(pi * (i + 120)) x3 = a + r * SIN(pi * (i - 120)) y3 = b + r * COS(pi * (i - 120)) LINE (x1, y1)-(x2, y2), c LINE (x2, y2)-(x3, y3), c LINE (x3, y3)-(x1, y1), c a = a + d b = b + e IF a <= r THEN d = 1: GOSUB soun IF a >= (319 - r) THEN d = -1: GOSUB soun IF b <= r THEN e = 1: GOSUB soun IF b >= (199 - r) THEN e = -1: GOSUB soun FOR t = 1 TO s: NEXT t LINE (x1, y1)-(x2, y2), 0 LINE (x2, y2)-(x3, y3), 0 LINE (x3, y3)-(x1, y1), 0 c = c + .1 IF c >= 103 THEN c = 32 NEXT i GOTO 1 soun: FOR u = 1 TO 12 SOUND 11700 * RND + 2137, .0229 NEXT u RETURN