Author Topic: Star Parallax Screensavers (Vertical / Horizontal)  (Read 920 times)

0 Members and 1 Guest are viewing this topic.

Offline CloudZimmermann

  • Newbie
  • Posts: 4
    • View Profile
Star Parallax Screensavers (Vertical / Horizontal)
« on: May 16, 2020, 05:00:30 pm »
Programs: Star Parallax Screensavers (Vertical / Horizontal)
Created: May 16th, 2020
Creator: Cloud Zimmermann



Code: QB64: [Select]
  1. ' Program: Star Parallax Screensaver (Vertical)
  2. ' Created: May 16th, 2020
  3. ' Creator: Cloud Zimmermann
  4.  
  5. SCREEN 7, 1, 0, 1
  6.  
  7. CONST screenWidth% = 320
  8. CONST screenHeight% = 200
  9. CONST count% = 200
  10. DIM SHARED stars%(count%, 5)
  11.  
  12. FOR i% = 1 TO count% - 1
  13.     CALL resetStar(i%, 1)
  14. NEXT i%
  15.  
  16.     CLS
  17.     FOR i% = 1 TO count% - 1
  18.         IF stars%(i%, 2) > screenHeight% THEN
  19.             CALL resetStar(i%, 0)
  20.         ELSE
  21.             stars%(i%, 2) = stars%(i%, 2) + stars%(i%, 3)
  22.         END IF
  23.         PSET (stars%(i%, 1), stars%(i%, 2)), stars%(i%, 4)
  24.     NEXT i%
  25.     PCOPY 0, 1
  26.     _LIMIT 60
  27.  
  28. SUB resetStar (starSelected%, init%)
  29.     IF init% = 1 THEN
  30.         stars%(starSelected%, 2) = INT(RND * screenHeight%) + 1
  31.     ELSE
  32.         stars%(starSelected%, 2) = 1
  33.     END IF
  34.  
  35.     stars%(starSelected%, 1) = INT(RND * screenWidth%) + 1
  36.     stars%(starSelected%, 3) = INT(RND * 3) + 1
  37.  
  38.     SELECT CASE INT(RND * 3) + 1
  39.         CASE 1
  40.             stars%(starSelected%, 4) = 15
  41.         CASE 2
  42.             stars%(starSelected%, 4) = 7
  43.         CASE ELSE
  44.             stars%(starSelected%, 4) = 8
  45.     END SELECT
  46.  
  47.  

Code: QB64: [Select]
  1. ' Program: Star Parallax Screensaver (Horizontal)
  2. ' Created: May 16th, 2020
  3. ' Creator: Cloud Zimmermann
  4.  
  5. SCREEN 7, 1, 0, 1
  6.  
  7. CONST screenWidth% = 320
  8. CONST screenHeight% = 200
  9. CONST count% = 200
  10. DIM SHARED stars%(count%, 5)
  11.  
  12. FOR i% = 1 TO count% - 1
  13.     CALL resetStar(i%, 1)
  14. NEXT i%
  15.  
  16.     CLS
  17.     FOR i% = 1 TO count% - 1
  18.         IF stars%(i%, 1) > screenWidth% THEN
  19.             CALL resetStar(i%, 0)
  20.         ELSE
  21.             stars%(i%, 1) = stars%(i%, 1) + stars%(i%, 3)
  22.         END IF
  23.         PSET (stars%(i%, 1), stars%(i%, 2)), stars%(i%, 4)
  24.     NEXT i%
  25.     PCOPY 0, 1
  26.     _LIMIT 60
  27.  
  28. SUB resetStar (starSelected%, init%)
  29.     IF init% = 1 THEN
  30.         stars%(starSelected%, 1) = INT(RND * screenWidth%) + 1
  31.     ELSE
  32.         stars%(starSelected%, 1) = 1
  33.     END IF
  34.  
  35.     stars%(starSelected%, 2) = INT(RND * screenHeight%) + 1
  36.     stars%(starSelected%, 3) = INT(RND * 3) + 1
  37.  
  38.     SELECT CASE INT(RND * 3) + 1
  39.         CASE 1
  40.             stars%(starSelected%, 4) = 15
  41.         CASE 2
  42.             stars%(starSelected%, 4) = 7
  43.         CASE ELSE
  44.             stars%(starSelected%, 4) = 8
  45.     END SELECT
  46.  
  47.  
* SPSSV.exe (Filesize: 1.99 MB, Downloads: 161)
* SPSSH.exe (Filesize: 1.99 MB, Downloads: 141)
* SPSSV.BAS (Filesize: 1.17 KB, Downloads: 124)
* SPSSH.BAS (Filesize: 1.17 KB, Downloads: 136)
* SPSSV-QB.BAS (Filesize: 1.09 KB, Downloads: 128)
* SPSSH-QB.BAS (Filesize: 1.1 KB, Downloads: 121)
preview.gif
* preview.gif (Filesize: 134.3 KB, Dimensions: 325x204, Views: 228)
« Last Edit: May 16, 2020, 06:27:28 pm by CloudZimmermann »

Offline Ashish

  • Forum Resident
  • Posts: 630
  • Never Give Up!
    • View Profile
Re: Star Parallax Screensavers (Vertical / Horizontal)
« Reply #1 on: May 17, 2020, 11:39:20 am »
Nice work :)
if (Me.success) {Me.improve()} else {Me.tryAgain()}


My Projects - https://github.com/AshishKingdom?tab=repositories
OpenGL tutorials - https://ashishkingdom.github.io/OpenGL-Tutorials