Author Topic: Old School Laser Show  (Read 3221 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Old School Laser Show
« on: April 21, 2021, 07:10:03 pm »
Hi all, I thought I would tinker with QB64 today to see if my imagination would spark anything finally. Well, instead of my imagination my memories went back to old old old school lasers. So after messing with it for a couple hours, I made this. It's 4 lasers at a time with a slight afterglow. I used only 7 basic colors so they would be bright and simple. It's always the simple stuff like this that recharges me. Also goes good with rock music. :)

Code: QB64: [Select]
  1. _TITLE "Laser Show - by SierraKen - Press Esc to end."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. c1 = 255
  4. c2 = 0
  5. c3 = 0
  6. c4 = 255
  7. c5 = 0
  8. c6 = 0
  9.  
  10. c7 = 255
  11. c8 = 0
  12. c9 = 0
  13. c10 = 255
  14. c11 = 0
  15. c12 = 0
  16.  
  17.     _LIMIT 10
  18.     a$ = INKEY$
  19.     IF a$ = CHR$(27) THEN END
  20.     col = INT(RND * 100) + 1
  21.     IF col > 90 THEN
  22.         c = INT(RND * 7) + 1
  23.         IF c = 1 THEN
  24.             c1 = 255: c2 = 0: c3 = 0
  25.         END IF
  26.         IF c = 2 THEN
  27.             c1 = 0: c2 = 255: c3 = 0
  28.         END IF
  29.         IF c = 3 THEN
  30.             c1 = 0: c2 = 0: c3 = 255
  31.         END IF
  32.         IF c = 4 THEN
  33.             c1 = 0: c2 = 255: c3 = 255
  34.         END IF
  35.         IF c = 5 THEN
  36.             c1 = 255: c2 = 255: c3 = 0
  37.         END IF
  38.         IF c = 6 THEN
  39.             c1 = 255: c2 = 0: c3 = 255
  40.         END IF
  41.         IF c = 7 THEN
  42.             c1 = 255: c2 = 255: c3 = 255
  43.         END IF
  44.     END IF
  45.     oldx = x
  46.     oldy = y
  47.     x = RND * 800
  48.     y = RND * 600
  49.     LINE (oldx, oldy)-(x, y), _RGB32(c1, c2, c3)
  50.     col2 = INT(RND * 100) + 1
  51.     IF col2 > 90 THEN
  52.         c2 = INT(RND * 7) + 1
  53.         IF c2 = 1 THEN
  54.             c4 = 255: c5 = 0: c6 = 0
  55.         END IF
  56.         IF c2 = 2 THEN
  57.             c4 = 0: c5 = 255: c6 = 0
  58.         END IF
  59.         IF c2 = 3 THEN
  60.             c4 = 0: c5 = 0: c6 = 255
  61.         END IF
  62.         IF c2 = 4 THEN
  63.             c4 = 0: c5 = 255: c6 = 255
  64.         END IF
  65.         IF c2 = 5 THEN
  66.             c4 = 255: c5 = 255: c6 = 0
  67.         END IF
  68.         IF c2 = 6 THEN
  69.             c4 = 255: c5 = 0: c6 = 255
  70.         END IF
  71.         IF c2 = 7 THEN
  72.             c4 = 255: c5 = 255: c6 = 255
  73.         END IF
  74.     END IF
  75.     oldx2 = x2
  76.     oldy2 = y2
  77.     x2 = RND * 800
  78.     y2 = RND * 600
  79.     LINE (oldx2, oldy2)-(x2, y2), _RGB32(c4, c5, c6)
  80.  
  81.     col3 = INT(RND * 100) + 1
  82.     IF col3 > 90 THEN
  83.         c3 = INT(RND * 7) + 1
  84.         IF c3 = 1 THEN
  85.             c7 = 255: c8 = 0: c9 = 0
  86.         END IF
  87.         IF c3 = 2 THEN
  88.             c7 = 0: c8 = 255: c9 = 0
  89.         END IF
  90.         IF c3 = 3 THEN
  91.             c7 = 0: c8 = 0: c9 = 255
  92.         END IF
  93.         IF c3 = 4 THEN
  94.             c7 = 0: c8 = 255: c9 = 255
  95.         END IF
  96.         IF c3 = 5 THEN
  97.             c7 = 255: c8 = 255: c9 = 0
  98.         END IF
  99.         IF c3 = 6 THEN
  100.             c7 = 255: c8 = 0: c9 = 255
  101.         END IF
  102.         IF c3 = 7 THEN
  103.             c7 = 255: c8 = 255: c9 = 255
  104.         END IF
  105.     END IF
  106.     oldx3 = x3
  107.     oldy3 = y3
  108.     x3 = RND * 800
  109.     y3 = RND * 600
  110.     LINE (oldx3, oldy3)-(x3, y3), _RGB32(c7, c8, c9)
  111.     col4 = INT(RND * 100) + 1
  112.     IF col4 > 90 THEN
  113.         c4 = INT(RND * 7) + 1
  114.         IF c4 = 1 THEN
  115.             c10 = 255: c11 = 0: c12 = 0
  116.         END IF
  117.         IF c4 = 2 THEN
  118.             c10 = 0: c11 = 255: c12 = 0
  119.         END IF
  120.         IF c4 = 3 THEN
  121.             c10 = 0: c11 = 0: c12 = 255
  122.         END IF
  123.         IF c4 = 4 THEN
  124.             c10 = 0: c11 = 255: c12 = 255
  125.         END IF
  126.         IF c4 = 5 THEN
  127.             c10 = 255: c11 = 255: c12 = 0
  128.         END IF
  129.         IF c4 = 6 THEN
  130.             c10 = 255: c11 = 0: c12 = 255
  131.         END IF
  132.         IF c4 = 7 THEN
  133.             c10 = 255: c11 = 255: c12 = 255
  134.         END IF
  135.     END IF
  136.     oldx4 = x4
  137.     oldy4 = y4
  138.     x4 = RND * 800
  139.     y4 = RND * 600
  140.     LINE (oldx4, oldy4)-(x4, y4), _RGB32(c10, c11, c12)
  141.  
  142.     LINE (0, 0)-(800, 600), _RGB32(0, 0, 0, 40), BF
  143.  
  144.  

« Last Edit: April 21, 2021, 07:15:08 pm by SierraKen »

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Old School Laser Show
« Reply #1 on: April 21, 2021, 07:42:22 pm »
Makes me want to light a Bic. ;)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Old School Laser Show
« Reply #2 on: April 21, 2021, 07:45:15 pm »
Hey Ken, welcome back! you were missed.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Old School Laser Show
« Reply #3 on: April 21, 2021, 08:39:46 pm »
:) Thanks Bplus. LOL a Bic.