Author Topic: My wish  (Read 4739 times)

0 Members and 1 Guest are viewing this topic.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
My wish
« on: July 02, 2018, 12:03:56 pm »
I want something for you all. Why not say this with program :-D






Code: QB64: [Select]
  1. REDIM P0(0, 0) AS INTEGER
  2. REDIM p1(0, 0) AS INTEGER
  3. REDIM p2(0, 0) AS INTEGER
  4. REDIM p3(0, 0) AS INTEGER
  5. REDIM p4(0, 0) AS INTEGER
  6. REDIM p5(0, 0) AS INTEGER
  7. REDIM p6(0, 0) AS INTEGER
  8. DIM SHARED image AS LONG, ext
  9.  
  10. a& = _NEWIMAGE(800, 600, 32): _FULLSCREEN
  11. CLS , _RGB32(6, 89, 244)
  12. image& = _NEWIMAGE(50, 50, 32)
  13.  
  14. _PUTIMAGE , CB&, image&
  15. _CLEARCOLOR _RGB32(0, 0, 0), image&
  16.  
  17. text$ = "Petr"
  18. TextToArray P0(), text$
  19. TextToArray p1(), "wish"
  20. TextToArray p2(), "you"
  21. TextToArray p3(), "a"
  22. TextToArray p4(), "lot"
  23. TextToArray p5(), "of"
  24. TextToArray p6(), "fun!"
  25.  
  26. m = (LEN(text$) * 8) / 2
  27. n = 16
  28. o = 12
  29. p = 4
  30. q = 12
  31. r = 8
  32. s = 16
  33.  
  34.     ToScreen P0(), m, 20
  35.     ToScreen p1(), n, 20
  36.     ToScreen p2(), o, 20
  37.     ToScreen p3(), p, 20
  38.     ToScreen p4(), q, 20
  39.     ToScreen p5(), r, 20
  40.     ToScreen p6(), s, 20
  41. _FREEIMAGE image&
  42. ERASE P0, p1, p2, p3, p4, p5, p6
  43.  
  44. SUB ToScreen (array() AS INTEGER, lenght AS _BYTE, speed AS _UNSIGNED _BYTE)
  45.     FOR sx = -15 TO 20 STEP .4
  46.         CLS , _RGB32(6, 89, 244)
  47.         DrawArray array(), _WIDTH / 2 - (sx * lenght), _HEIGHT / 2 - sx * 8, sx, sx
  48.         _LIMIT speed
  49.         _DISPLAY
  50.     NEXT sx
  51.     _DELAY .5
  52.  
  53. SUB DrawArray (p() AS INTEGER, posx, posy, roztecx, roztecy)
  54.     MaxX = UBOUND(p, 1): MaxY = UBOUND(p, 2)
  55.     MinX = LBOUND(p, 1): MinY = LBOUND(p, 2)
  56.     FOR y = MinY TO MaxY
  57.         FOR x = MinX TO MaxX
  58.             IF p(x, y) THEN _PUTIMAGE (posx + (x * roztecx), posy + (y * roztecy)), image&
  59.             IF _KEYHIT = 27 THEN pad p(), x, y, roztecx, roztecy, posx, posy
  60.     NEXT x, y
  61.  
  62. SUB pad (p() AS INTEGER, x AS INTEGER, y AS INTEGER, roztecx, roztecy, posx, posy)
  63.     MaxX = UBOUND(p, 1): MaxY = UBOUND(p, 2)
  64.     MinX = LBOUND(p, 1): MinY = LBOUND(p, 2)
  65.  
  66.     DO WHILE Down < 800
  67.         CLS , _RGB32(6, 89, 244)
  68.         FOR y = MinY TO MaxY
  69.             Down = Down + RND * 5
  70.             FOR x = MinX TO MaxX
  71.                 IF p(x, y) THEN _PUTIMAGE (posx + (x * roztecx), (posy + (y * roztecy)) + Down), image&
  72.             NEXT
  73.         NEXT
  74.         _LIMIT 15
  75.         _DISPLAY
  76.     LOOP
  77.     SCREEN 0
  78.     _FREEIMAGE image&
  79.     END
  80.  
  81. SUB TextToArray (array( x , y) AS INTEGER, text AS STRING)
  82.     v& = _NEWIMAGE(LEN(text$) * 8, 16, 256)
  83.     REDIM array(LEN(text$) * 8, 16)
  84.     _DEST v&
  85.     _PRINTSTRING (1, 1), text$, v&
  86.     _DEST 0
  87.     _SOURCE v&
  88.     FOR y = 0 TO 15
  89.         PRINT
  90.         FOR x = 0 TO 8 * LEN(text$) - 1
  91.             IF POINT(x, y) THEN array(x, y) = 1
  92.     NEXT x, y
  93.     _DEST 0: _SOURCE 0
  94.  
  95.     CB& = _NEWIMAGE(40, 40, 256)
  96.     FOR F = 31 TO 16 STEP -1
  97.         rd = rd + 1
  98.         FOR R = 0 TO _PI(2) STEP .01
  99.             _DEST CB&
  100.             CIRCLE (SIN(R) + 20, COS(R) + 20), rd, F
  101.     NEXT R, F
  102.  

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: My wish
« Reply #1 on: July 02, 2018, 05:31:43 pm »
Cool... Thank you!

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: My wish
« Reply #2 on: July 02, 2018, 08:27:42 pm »
Hi Petr (and all!),

I have coded a reply! After extracting zip file, load and run .bas file, press p for play...
* Paint Balls v2 plasma.zip (Filesize: 12.6 KB, Downloads: 254)
« Last Edit: July 02, 2018, 08:31:08 pm by bplus »