Author Topic: JackStack - Halloween puzzle game  (Read 9613 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: JackStack - Halloween puzzle game
« Reply #30 on: October 12, 2021, 03:54:17 pm »
Yes with white circles and display and delay immediately on collision,  I have confirmed a guess about the corn boundaries for their x,y's, the x,y's are corn centers for Rotozoom x, y's are centers not corners, that is why I subtract half the height or width (75) for collision checking between two box images for the x, y top left corner, plus did not use full 75 for width, height. For witch I should have used full 75x75 for that image,

Theoretically you might want collision detection for the Corn circle not the corn box that would sit square with x,y axis, a picture is worth a 1000 words:
Code: QB64: [Select]
  1.  
  2.  
  3. Screen _NewImage(640, 640, 32)
  4.  
  5. board& = _LoadImage("background.png", 32)
  6. jack& = _LoadImage("pumpkin.png")
  7. witch& = _LoadImage("witch.png"): witchx = -300: witchy = 100 + (Rnd * 300)
  8. grass& = _LoadImage("grass.png")
  9. candy& = _LoadImage("candy.png")
  10.  
  11. jackys = 7
  12. Dim Shared jackysx(jackys), jackysy(jackys), jackysr(jackys)
  13.  
  14. raise& = _SndOpen("sfx_roll.ogg")
  15.  
  16. '======
  17. restart:
  18. '======
  19.  
  20. witchflyx = 20
  21. witchflyy = 300
  22. grassx = 0
  23.  
  24. candycount = 0
  25.  
  26. For j = 1 To jackys
  27.     jackysx(j) = _Width + (Rnd * _Width) * 2
  28.     jackysy(j) = 40 + (Rnd * (_Height - 100))
  29.     jackysr(j) = Rnd * 360
  30.  
  31.  
  32.  
  33.     Cls , _RGB(99, 49, 0)
  34.  
  35.     PPRINT 300, 10, 16, _RGB(255, 255, 255), 255, Str$(candycount)
  36.  
  37.     _PutImage (grassx, 0), grass&
  38.     _PutImage (grassx + 640, 0), grass&
  39.  
  40.     'draw candies
  41.     For j = 1 To jackys
  42.         '_PUTIMAGE (jackysx(j), jackysy(j)), candy&
  43.         RotoZoom3 jackysx(j), jackysy(j), candy&, 1, 1, _D2R(jackysr(j))
  44.         ' check boundary of images with circles, confirm  jackysx(j), jackysy(j) is a center NOT a CORNER
  45.         Circle (jackysx(j), jackysy(j)), 75 / 2, &HFFFFFFFF
  46.         jackysr(j) = jackysr(j) + 3
  47.         If jackysr(j) > 360 Then jackysr(j) = 1
  48.     Next
  49.  
  50.     'if pressed space
  51.     If Inp(&H60) = 57 Then
  52.  
  53.         If Not _SndPlaying(raise&) Then _SndPlay raise&
  54.  
  55.         witchflyy = witchflyy - 2
  56.         witchflyx = witchflyx + 1
  57.     Else
  58.         _SndStop raise&
  59.         witchflyy = witchflyy + 1
  60.         witchflyx = witchflyx - .5
  61.     End If
  62.  
  63.     'keep witch in bounds
  64.     If witchflyx < 5 Then witchflyx = 5
  65.     If witchflyx > _Width - 75 Then witchflyx = _Width - 75
  66.     If witchflyy < 40 Then witchflyy = 40
  67.     If witchflyy > 500 Then witchflyy = 500
  68.  
  69.     _Limit 150
  70.  
  71.     _PutImage (witchflyx, witchflyy), witch&
  72.     _Display
  73.  
  74.     grassx = grassx - 1
  75.     If grassx <= -640 Then grassx = 0
  76.  
  77.  
  78.     '========================= collision dectection here ===========
  79.  
  80.     'see if witch hit a candy
  81.     For j = 1 To jackys
  82.  
  83.         wx1 = witchflyx: wy1 = witchflyy
  84.         wx2 = wx1 + 75: wy2 = wy1 + 75
  85.         jx1 = jackysx(j): jy1 = jackysy(j)
  86.         jx2 = jx1 + 75: jy2 = jy1 + 75
  87.  
  88.  
  89.         'hit = 0
  90.         'If wx2 >= jx1 Then
  91.         '    If wx1 <= jx2 Then
  92.         '        If wy2 >= jy1 Then
  93.         '            If wy1 <= jy2 Then hit = 1
  94.         '        End If
  95.         '    End If
  96.         'End If
  97.         hit = collision%(wx1, wy1, 75, 75, jackysx(j) - 37, jackysy(j) - 37, 60, 60)
  98.  
  99.         If hit Then
  100.             _SndPlayFile "sfx_dropdown.mp3"
  101.             _Display
  102.             _Delay 2
  103.  
  104.             Cls , _RGB(99, 49, 0)
  105.             PPRINT 300, 10, 16, _RGB(255, 255, 255), 255, Str$(candycount)
  106.             _PutImage (grassx, 0), grass&
  107.             _PutImage (grassx + 640, 0), grass&
  108.  
  109.             'draw jacks
  110.             For j2 = 1 To jackys
  111.                 ' _PUTIMAGE (jackysx(j), jackysy(j)), candy&
  112.                 RotoZoom3 jackysx(j2), jackysy(j2), candy&, 1, 1, _D2R(jackysr(j2))
  113.             Next
  114.  
  115.             tmp& = _CopyImage(_Display)
  116.             'spin witch out here
  117.             r = 1
  118.             For dy = witchflyy + 35 To _Height Step 3
  119.                 _PutImage (0, 0), tmp&
  120.                 RotoZoom3 witchflyx + 75, dy, witch&, 1, 1, _D2R(r)
  121.                 r = r + 5: If r > 360 Then r = 1
  122.                 _Limit 150
  123.                 _Display
  124.             Next
  125.             _FreeImage tmp&
  126.  
  127.             Exit Do
  128.  
  129.         End If
  130.  
  131.     Next
  132.  
  133.  
  134.     'move candies, compute
  135.     For j = 1 To jackys
  136.  
  137.         jackysx(j) = jackysx(j) - 2
  138.         If jackysx(j) < -75 Then
  139.  
  140.             candycount = candycount + 1
  141.  
  142.             'If won...
  143.             If candycount > 75 Then
  144.                 _SndPlayFile "sfx_clap.ogg"
  145.                 _Delay 3
  146.                 End
  147.             End If
  148.  
  149.             jackysx(j) = _Width + (Rnd * _Width) * 2
  150.             jackysy(j) = 40 + (Rnd * (_Height - 100))
  151.         End If
  152.     Next
  153.  
  154.  
  155. GoTo restart
  156.  
  157.  
  158.  
  159. Sub PPRINT (x, y, size, clr&, trans&, text$)
  160.     'This sub outputs to the current _DEST set
  161.     'It makes trans& the transparent color
  162.  
  163.     'x/y is where to print text
  164.     'size is the font size to use
  165.     'clr& is the color of your text
  166.     'trans& is the background transparent color
  167.     'text$ is the string to print
  168.  
  169.     '=== get users current write screen
  170.     orig& = _Dest
  171.  
  172.     '=== if you are using an 8 or 32 bit screen
  173.     bit = 32: If _PixelSize(0) = 1 Then bit = 256
  174.  
  175.     '=== step through your text
  176.     For t = 0 To Len(text$) - 1
  177.         '=== make a temp screen to use
  178.         pprintimg& = _NewImage(16, 16, bit)
  179.         _Dest pprintimg&
  180.         '=== set colors and print text
  181.         Cls , trans&: Color clr&
  182.         Print Mid$(text$, t + 1, 1);
  183.         '== make background color the transprent one
  184.         _ClearColor _RGB(0, 0, 0), pprintimg&
  185.         '=== go back to original screen  to output
  186.         _Dest orig&
  187.         '=== set it and forget it
  188.         x1 = x + (t * size): x2 = x1 + size
  189.         y1 = y: y2 = y + size
  190.         _PutImage (x1 - (size / 2), y1)-(x2, y2 + (size / 3)), pprintimg&
  191.         _FreeImage pprintimg&
  192.     Next
  193.  
  194. ' Description:
  195. ' Started from a mod of Galleon's in Wiki that both scales and rotates an image.
  196. ' This version scales the x-axis and y-axis independently allowing rotations of image just by changing X or Y Scales
  197. ' making this tightly coded routine a very powerful and versatile image tool.
  198.  
  199.  
  200. Sub RotoZoom3 (X As Long, Y As Long, Image As Long, xScale As Single, yScale As Single, radianRotation As Single)
  201.     ' This assumes you have set your drawing location with _DEST or default to screen.
  202.     ' X, Y - is where you want to put the middle of the image
  203.     ' Image - is the handle assigned with _LOADIMAGE
  204.     ' xScale, yScale - are shrinkage < 1 or magnification > 1 on the given axis, 1 just uses image size.
  205.     ' These are multipliers so .5 will create image .5 size on given axis and 2 for twice image size.
  206.     ' radianRotation is the Angle in Radian units to rotate the image
  207.     ' note: Radian units for rotation because it matches angle units of other Basic Trig functions
  208.     '       and saves a little time converting from degree.
  209.     '       Use the _D2R() function if you prefer to work in degree units for angles.
  210.  
  211.     Dim px(3) As Single: Dim py(3) As Single ' simple arrays for x, y to hold the 4 corners of image
  212.     Dim W&, H&, sinr!, cosr!, i&, x2&, y2& '   variables for image manipulation
  213.     W& = _Width(Image&): H& = _Height(Image&)
  214.     px(0) = -W& / 2: py(0) = -H& / 2 'left top corner
  215.     px(1) = -W& / 2: py(1) = H& / 2 ' left bottom corner
  216.     px(2) = W& / 2: py(2) = H& / 2 '  right bottom
  217.     px(3) = W& / 2: py(3) = -H& / 2 ' right top
  218.     sinr! = Sin(-radianRotation): cosr! = Cos(-radianRotation) ' rotation helpers
  219.     For i& = 0 To 3 ' calc new point locations with rotation and zoom
  220.         x2& = xScale * (px(i&) * cosr! + sinr! * py(i&)) + X: y2& = yScale * (py(i&) * cosr! - px(i&) * sinr!) + Y
  221.         px(i&) = x2&: py(i&) = y2&
  222.     Next
  223.     _MapTriangle _Seamless(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
  224.     _MapTriangle _Seamless(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
  225.  
  226.  
  227. Function collision% (b1x, b1y, b1w, b1h, b2x, b2y, b2w, b2h)
  228.     ' x, y represent the box left most x and top most y
  229.     ' w, h represent the box width and height which is the usual way sprites / tiles / images are described
  230.     ' such that boxbottom = by + bh
  231.     '        and boxright = bx + bw
  232.     'so the specific gosub above is generalized to a function procedure here!
  233.     If (b1y + b1h < b2y) Or (b1y > b2y + b2h) Or (b1x > b2x + b2w) Or (b1x + b1w < b2x) Then
  234.         collision% = 0
  235.     Else
  236.         collision% = -1 ' Collsion is true
  237.     End If
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  

Might be better to do collision check between box and a circle,

Does anyone have that?

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: JackStack - Halloween puzzle game
« Reply #31 on: October 12, 2021, 07:12:54 pm »
That circle is  a smart way to see what's going on there.   I shrank the witch boundaries a little, and this seems to be look better with most collisions - no hits so far away as to look odd. 

Code: QB64: [Select]
  1. hit = collision%(wx1 + 15, wy1 + 15, 60, 60, jackysx(j) - 37, jackysy(j) - 37, 60, 60)
  2.  

- Dav


Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: JackStack - Halloween puzzle game
« Reply #32 on: October 12, 2021, 09:12:01 pm »
Excellent!

Had to rush to get mom to doc appointment so I'm sorry I didn't think of this the first time around but now checking your box circle numbers, I put white frames for the witch borders to check :
Code: QB64: [Select]
  1.  
  2.  
  3. Screen _NewImage(640, 640, 32)
  4.  
  5. board& = _LoadImage("background.png", 32)
  6. jack& = _LoadImage("pumpkin.png")
  7. witch& = _LoadImage("witch.png"): witchx = -300: witchy = 100 + (Rnd * 300)
  8. grass& = _LoadImage("grass.png")
  9. candy& = _LoadImage("candy.png")
  10.  
  11. jackys = 7
  12. Dim Shared jackysx(jackys), jackysy(jackys), jackysr(jackys)
  13.  
  14. raise& = _SndOpen("sfx_roll.ogg")
  15.  
  16. '======
  17. restart:
  18. '======
  19.  
  20. witchflyx = 20
  21. witchflyy = 300
  22. grassx = 0
  23.  
  24. candycount = 0
  25.  
  26. For j = 1 To jackys
  27.     jackysx(j) = _Width + (Rnd * _Width) * 2
  28.     jackysy(j) = 40 + (Rnd * (_Height - 100))
  29.     jackysr(j) = Rnd * 360
  30.  
  31.  
  32.  
  33.     Cls , _RGB(99, 49, 0)
  34.  
  35.     PPRINT 300, 10, 16, _RGB(255, 255, 255), 255, Str$(candycount)
  36.  
  37.     _PutImage (grassx, 0), grass&
  38.     _PutImage (grassx + 640, 0), grass&
  39.  
  40.     'draw candies
  41.     For j = 1 To jackys
  42.         '_PUTIMAGE (jackysx(j), jackysy(j)), candy&
  43.         RotoZoom3 jackysx(j), jackysy(j), candy&, 1, 1, _D2R(jackysr(j))
  44.         ' check boundary of images with circles, confirm  jackysx(j), jackysy(j) is a center NOT a CORNER
  45.         Circle (jackysx(j), jackysy(j)), 75 / 2, &HFFFFFFFF
  46.         jackysr(j) = jackysr(j) + 3
  47.         If jackysr(j) > 360 Then jackysr(j) = 1
  48.     Next
  49.  
  50.     'if pressed space
  51.     If Inp(&H60) = 57 Then
  52.  
  53.         If Not _SndPlaying(raise&) Then _SndPlay raise&
  54.  
  55.         witchflyy = witchflyy - 2
  56.         witchflyx = witchflyx + 1
  57.     Else
  58.         _SndStop raise&
  59.         witchflyy = witchflyy + 1
  60.         witchflyx = witchflyx - .5
  61.     End If
  62.  
  63.     'keep witch in bounds
  64.     If witchflyx < 5 Then witchflyx = 5
  65.     If witchflyx > _Width - 75 Then witchflyx = _Width - 75
  66.     If witchflyy < 40 Then witchflyy = 40
  67.     If witchflyy > 500 Then witchflyy = 500
  68.  
  69.     _Limit 150
  70.  
  71.     _PutImage (witchflyx, witchflyy), witch&
  72.     '   collision%(wx1 + 15, wy1 + 15, 60, 60, jackysx(j) - 37, jackysy(j) - 37, 60, 60) ' dav's mod
  73.     Line (witchflyx + 15, witchflyy + 15)-Step(60, 60), &HFFFFFFFF, B
  74.     _Display
  75.  
  76.     grassx = grassx - 1
  77.     If grassx <= -640 Then grassx = 0
  78.  
  79.  
  80.     '========================= collision dectection here ===========
  81.  
  82.     'see if witch hit a candy
  83.     For j = 1 To jackys
  84.  
  85.         wx1 = witchflyx: wy1 = witchflyy
  86.         wx2 = wx1 + 75: wy2 = wy1 + 75
  87.         jx1 = jackysx(j): jy1 = jackysy(j)
  88.         jx2 = jx1 + 75: jy2 = jy1 + 75
  89.  
  90.  
  91.         'hit = 0
  92.         'If wx2 >= jx1 Then
  93.         '    If wx1 <= jx2 Then
  94.         '        If wy2 >= jy1 Then
  95.         '            If wy1 <= jy2 Then hit = 1
  96.         '        End If
  97.         '    End If
  98.         'End If
  99.         'hit = collision%(wx1, wy1, 75, 75, jackysx(j) - 37, jackysy(j) - 37, 60, 60)
  100.         hit = collision%(wx1 + 15, wy1 + 15, 60, 60, jackysx(j) - 37, jackysy(j) - 37, 60, 60) ' dav's mod
  101.         If hit Then
  102.             _SndPlayFile "sfx_dropdown.mp3"
  103.             _Display
  104.             _Delay 2
  105.  
  106.             Cls , _RGB(99, 49, 0)
  107.             PPRINT 300, 10, 16, _RGB(255, 255, 255), 255, Str$(candycount)
  108.             _PutImage (grassx, 0), grass&
  109.             _PutImage (grassx + 640, 0), grass&
  110.  
  111.             'draw jacks
  112.             For j2 = 1 To jackys
  113.                 ' _PUTIMAGE (jackysx(j), jackysy(j)), candy&
  114.                 RotoZoom3 jackysx(j2), jackysy(j2), candy&, 1, 1, _D2R(jackysr(j2))
  115.             Next
  116.  
  117.             tmp& = _CopyImage(_Display)
  118.             'spin witch out here
  119.             r = 1
  120.             For dy = witchflyy + 35 To _Height Step 3
  121.                 _PutImage (0, 0), tmp&
  122.                 RotoZoom3 witchflyx + 75, dy, witch&, 1, 1, _D2R(r)
  123.                 r = r + 5: If r > 360 Then r = 1
  124.                 _Limit 150
  125.                 _Display
  126.             Next
  127.             _FreeImage tmp&
  128.  
  129.             Exit Do
  130.  
  131.         End If
  132.  
  133.     Next
  134.  
  135.  
  136.     'move candies, compute
  137.     For j = 1 To jackys
  138.  
  139.         jackysx(j) = jackysx(j) - 2
  140.         If jackysx(j) < -75 Then
  141.  
  142.             candycount = candycount + 1
  143.  
  144.             'If won...
  145.             If candycount > 75 Then
  146.                 _SndPlayFile "sfx_clap.ogg"
  147.                 _Delay 3
  148.                 End
  149.             End If
  150.  
  151.             jackysx(j) = _Width + (Rnd * _Width) * 2
  152.             jackysy(j) = 40 + (Rnd * (_Height - 100))
  153.         End If
  154.     Next
  155.  
  156.  
  157. GoTo restart
  158.  
  159.  
  160.  
  161. Sub PPRINT (x, y, size, clr&, trans&, text$)
  162.     'This sub outputs to the current _DEST set
  163.     'It makes trans& the transparent color
  164.  
  165.     'x/y is where to print text
  166.     'size is the font size to use
  167.     'clr& is the color of your text
  168.     'trans& is the background transparent color
  169.     'text$ is the string to print
  170.  
  171.     '=== get users current write screen
  172.     orig& = _Dest
  173.  
  174.     '=== if you are using an 8 or 32 bit screen
  175.     bit = 32: If _PixelSize(0) = 1 Then bit = 256
  176.  
  177.     '=== step through your text
  178.     For t = 0 To Len(text$) - 1
  179.         '=== make a temp screen to use
  180.         pprintimg& = _NewImage(16, 16, bit)
  181.         _Dest pprintimg&
  182.         '=== set colors and print text
  183.         Cls , trans&: Color clr&
  184.         Print Mid$(text$, t + 1, 1);
  185.         '== make background color the transprent one
  186.         _ClearColor _RGB(0, 0, 0), pprintimg&
  187.         '=== go back to original screen  to output
  188.         _Dest orig&
  189.         '=== set it and forget it
  190.         x1 = x + (t * size): x2 = x1 + size
  191.         y1 = y: y2 = y + size
  192.         _PutImage (x1 - (size / 2), y1)-(x2, y2 + (size / 3)), pprintimg&
  193.         _FreeImage pprintimg&
  194.     Next
  195.  
  196. ' Description:
  197. ' Started from a mod of Galleon's in Wiki that both scales and rotates an image.
  198. ' This version scales the x-axis and y-axis independently allowing rotations of image just by changing X or Y Scales
  199. ' making this tightly coded routine a very powerful and versatile image tool.
  200.  
  201.  
  202. Sub RotoZoom3 (X As Long, Y As Long, Image As Long, xScale As Single, yScale As Single, radianRotation As Single)
  203.     ' This assumes you have set your drawing location with _DEST or default to screen.
  204.     ' X, Y - is where you want to put the middle of the image
  205.     ' Image - is the handle assigned with _LOADIMAGE
  206.     ' xScale, yScale - are shrinkage < 1 or magnification > 1 on the given axis, 1 just uses image size.
  207.     ' These are multipliers so .5 will create image .5 size on given axis and 2 for twice image size.
  208.     ' radianRotation is the Angle in Radian units to rotate the image
  209.     ' note: Radian units for rotation because it matches angle units of other Basic Trig functions
  210.     '       and saves a little time converting from degree.
  211.     '       Use the _D2R() function if you prefer to work in degree units for angles.
  212.  
  213.     Dim px(3) As Single: Dim py(3) As Single ' simple arrays for x, y to hold the 4 corners of image
  214.     Dim W&, H&, sinr!, cosr!, i&, x2&, y2& '   variables for image manipulation
  215.     W& = _Width(Image&): H& = _Height(Image&)
  216.     px(0) = -W& / 2: py(0) = -H& / 2 'left top corner
  217.     px(1) = -W& / 2: py(1) = H& / 2 ' left bottom corner
  218.     px(2) = W& / 2: py(2) = H& / 2 '  right bottom
  219.     px(3) = W& / 2: py(3) = -H& / 2 ' right top
  220.     sinr! = Sin(-radianRotation): cosr! = Cos(-radianRotation) ' rotation helpers
  221.     For i& = 0 To 3 ' calc new point locations with rotation and zoom
  222.         x2& = xScale * (px(i&) * cosr! + sinr! * py(i&)) + X: y2& = yScale * (py(i&) * cosr! - px(i&) * sinr!) + Y
  223.         px(i&) = x2&: py(i&) = y2&
  224.     Next
  225.     _MapTriangle _Seamless(0, 0)-(0, H& - 1)-(W& - 1, H& - 1), Image To(px(0), py(0))-(px(1), py(1))-(px(2), py(2))
  226.     _MapTriangle _Seamless(0, 0)-(W& - 1, 0)-(W& - 1, H& - 1), Image To(px(0), py(0))-(px(3), py(3))-(px(2), py(2))
  227.  
  228.  
  229. Function collision% (b1x, b1y, b1w, b1h, b2x, b2y, b2w, b2h)
  230.     ' x, y represent the box left most x and top most y
  231.     ' w, h represent the box width and height which is the usual way sprites / tiles / images are described
  232.     ' such that boxbottom = by + bh
  233.     '        and boxright = bx + bw
  234.     'so the specific gosub above is generalized to a function procedure here!
  235.     If (b1y + b1h < b2y) Or (b1y > b2y + b2h) Or (b1x > b2x + b2w) Or (b1x + b1w < b2x) Then
  236.         collision% = 0
  237.     Else
  238.         collision% = -1 ' Collsion is true
  239.     End If
  240.  
  241.  

Looks about right.

@Dav have you considered how to have some sort of a reasonable path through corn at all times or maybe the witch deserves to die to random placements of obstacles. Flappy bird always had a hole between pipes and pipes were spaced so you could drop or rise in time to get through placements.

Code: QB64: [Select]
  1. For j = 1 To jackys
  2.     jackysx(j) = _Width + (Rnd * _Width) * 2
  3.     jackysy(j) = 40 + (Rnd * (_Height - 100))
  4.     jackysr(j) = Rnd * 360
  5.  

Are you putting Candy on like a scroll for like a player piano, punching holes where candy is, so you just recycle to the scroll as you come to the end? I am not seeing new candy being created anywhere else in code, maybe I missed it. If true I am surprised, I didn't pick up on the pattern recycle. And If True you could draw a path in scroll the forbids random placement of a candy on the path. That way you don't make an impossible game. The path would have to end same place it starts and never turn more than witch could rise or fall.

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: JackStack - Halloween puzzle game
« Reply #33 on: October 13, 2021, 09:51:22 am »
It's hidden in the moving candies part.  When a candy goes off screen on the left then re-spawn it on the right somewhere. It would probably be a better idea to have a layout of somekind, so there would always be a way through when playing good.

- Dav


Code: QB64: [Select]
  1.     'move candies, compute
  2.     FOR j = 1 TO jackys
  3.  
  4.         jackysx(j) = jackysx(j) - 2
  5.         IF jackysx(j) < -75 THEN    '<<<<<<<< here it says bye
  6.  
  7.             candycount = candycount + 1
  8.  
  9.             'If won...
  10.             IF candycount > 75 THEN
  11.                 _SNDPLAYFILE "sfx_clap.ogg"
  12.                 _DELAY 3
  13.                 END
  14.             END IF
  15.  
  16.             jackysx(j) = _WIDTH + (RND * _WIDTH) * 2   '<<<<<< and here make new values
  17.             jackysy(j) = 40 + (RND * (_HEIGHT - 100))
  18.         END IF
  19.     NEXT

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: JackStack - Halloween puzzle game
« Reply #34 on: October 17, 2021, 11:51:28 am »
@Dav are you still dabbling with this? I have an idea for a Halloween Variation. You might look at what I was criticizing and arrive at same simple, easy fix solution. Hint, hint... ;-))

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: JackStack - Halloween puzzle game
« Reply #35 on: October 17, 2021, 12:41:08 pm »
I've haven't been the past few days, my music work has kind of piling up on me, but if you have an idea I sure would like to see it.   

- Dav

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: JackStack - Halloween puzzle game
« Reply #36 on: October 17, 2021, 01:24:25 pm »
Hi @Dav, Check your PM's.