Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Proggies
bplus Plinko

Code: (Select All)
Option _Explicit
_Title "bplus Plinko" ' b+ 2024-11-08
' from
' Bonkers Symphony no 37.bas for QB64 fork (B+=MGA) trans 2017-09-15
' from: Bonkers Symphony Number 37.bas SmallBASIC 0.12.8 [B+=MGA] 2017-04-21
' looking at vince version I see I am almost there with this one!

Const XMax = 800
Const YMax = 720
Dim Shared BX, BY, BA, BCnt
Randomize Timer
Screen _NewImage(XMax, YMax, 32): _ScreenMove 250, 0
_PrintMode _KeepBackground
Dim gravity, br, speed, pR, maxRow, np, pxo, pyo, row, col
Dim pidx, i, r, j, dx, dy, slotSpace, slot, score
Dim slots(11), s$
gravity = 2.0
slotSpace = XMax / 12
br = 27: speed = 4 'balls
pR = 5: maxRow = 11: np = maxRow * (maxRow + 1) * .5 ' pins
pxo = XMax / (maxRow + 1) 'pin space along x
pyo = YMax / (maxRow + 1) 'pin spacing along y
Dim px(np), py(np)
For row = 3 To maxRow
For col = 1 To row
pidx = pidx + 1
px(pidx) = pxo * col + (maxRow - row) * .5 * pxo
py(pidx) = pyo * row
Next
Next
NewBall
While 1
Line (0, 0)-(_Width, _Height - 48), &HFF333366, BF
Line (0, _Height - 48)-(_Width, _Height), &HFF008833, BF
For i = 1 To np 'draw pins
For r = pR To 1 Step -1
FC3 px(i), py(i), r, _RGB32(r / pR * 255)
Next
Next
For j = 1 To np 'calc collsions
If Sqr((BX - px(j)) ^ 2 + (BY - py(j)) ^ 2) < br + pR Then
BA = _Atan2(BY - py(j), BX - px(j))
FC3 px(j), py(j), pR, &HFF000000
Sound 120 + (YMax - py(j)) / YMax * 1000, .25
Exit For
End If
Next
dx = Cos(BA) * speed: dy = Sin(BA) * speed + gravity ' update ball
BA = _Atan2(dy, dx)
BX = BX + Cos(BA) * speed: BY = BY + Sin(BA) * speed ' + 2 * Rnd - 1
If BX < br Or BX > XMax + br Or BY > YMax + br Then
slot = Int(BX / slotSpace): slots(slot) = slots(slot) + 1: NewBall
End If
For r = br To 1 Step -1
FC3 BX, BY, r, _RGB32(255 - (r / br) * 160, 0, 0)
Next
score = 0
For i = 0 To 11
Select Case i
Case 0: s$ = " "
Case 11: s$ = " "
Case 1: score = score + slots(1) * 100: s$ = "x100$"
Case 10: score = score + slots(10) * 100: s$ = "x100$"
Case 2: score = score + slots(2) * 10: s$ = "x10$"
Case 9: score = score + slots(9) * 10: s$ = "x10$"
Case 3: score = score + slots(3) * 2: s$ = "x2$"
Case 8: score = score + slots(8) * 2: s$ = "x2$"
Case 4: score = score + slots(4) * 0: s$ = "x0$"
Case 7: score = score + slots(7) * 0: s$ = "x0$"
Case 5: score = score + slots(5) * -1: s$ = "x-1$"
Case 6: score = score + slots(6) * -1: s$ = "x-1$"
End Select
_PrintString (i * slotSpace + .5 * slotSpace - 16, _Height - 40), Str$(slots(i))
_PrintString (i * slotSpace + .5 * slotSpace - 16, _Height - 20), s$
Next
_PrintString (30, 30), "Balls:" + Str$(BCnt) + " Score: $" + _Trim$(Str$(score))
_Display: _Limit 30
Wend

Sub NewBall
BX = XMax / 2 + 10 * Rnd - 5: BY = 0 - Rnd * 20: BCnt = BCnt + 1
BA = _Pi(.5) + _Pi(2 / 90) * Rnd - _Pi(.9999 / 90)
End Sub

Sub FC3 (cx As Long, cy As Long, r As Long, clr~&)
Dim As Long r2, x, y ' for Option _Explicit
If r < 1 Then Exit Sub
Line (cx - r, cy)-(cx + r, cy), clr~&, BF
r2 = r * r
Do
y = y + 1: x = Sqr(r2 - y * y)
Line (cx - x, cy + y)-(cx + x, cy + y), clr~&, BF
Line (cx - x, cy - y)-(cx + x, cy - y), clr~&, BF
Loop Until y = r
End Sub

   
b = b + ...
Reply


Messages In This Thread
Proggies - by bplus - 04-24-2022, 04:02 PM
RE: Proggies - by bplus - 04-26-2022, 03:23 PM
RE: Proggies - by bplus - 04-26-2022, 04:24 PM
RE: Proggies - by bplus - 05-01-2022, 12:10 AM
RE: Proggies - by dcromley - 05-01-2022, 04:00 AM
RE: Proggies - by bplus - 05-01-2022, 02:52 PM
RE: Proggies - by bplus - 05-01-2022, 02:56 PM
RE: Proggies - by bplus - 05-01-2022, 08:05 PM
RE: Proggies - by bplus - 05-03-2022, 01:43 AM
RE: Proggies - by vince - 05-03-2022, 02:13 AM
RE: Proggies - by bplus - 05-03-2022, 02:16 AM
RE: Proggies - by bplus - 05-08-2022, 02:13 AM
RE: Proggies - by OldMoses - 05-08-2022, 12:40 PM
RE: Proggies - by bplus - 05-08-2022, 03:16 PM
RE: Proggies - by bplus - 05-16-2022, 12:21 AM
RE: Proggies - by bplus - 05-16-2022, 12:58 AM
RE: Proggies - by PhilOfPerth - 05-16-2022, 01:40 AM
RE: Proggies - by bplus - 05-16-2022, 01:28 AM
RE: Proggies - by SMcNeill - 05-16-2022, 12:49 PM
RE: Proggies - by bplus - 05-16-2022, 02:44 PM
RE: Proggies - by bplus - 05-17-2022, 11:16 PM
RE: Proggies - by vince - 05-25-2022, 05:08 AM
RE: Proggies - by bplus - 05-17-2022, 11:23 PM
RE: Proggies - by bplus - 05-17-2022, 11:42 PM
RE: Proggies - by bplus - 05-18-2022, 01:14 AM
RE: Proggies - by bplus - 05-19-2022, 06:43 PM
RE: Proggies - by bplus - 05-20-2022, 01:52 AM
RE: Proggies - by SierraKen - 05-20-2022, 03:44 AM
RE: Proggies - by bplus - 05-20-2022, 07:59 PM
RE: Proggies - by bplus - 05-20-2022, 08:34 PM
RE: Proggies - by Dav - 05-21-2022, 12:48 AM
RE: Proggies - by bplus - 05-25-2022, 12:47 AM
RE: Proggies - by bplus - 05-29-2022, 11:32 PM
RE: Proggies - by bplus - 05-30-2022, 01:41 PM
RE: Proggies - by bplus - 06-04-2022, 10:01 PM
RE: Proggies - by triggered - 06-05-2022, 03:44 AM
RE: Proggies - by bplus - 06-05-2022, 03:03 PM
RE: Proggies - by bplus - 06-06-2022, 08:04 PM
RE: Proggies - by bplus - 06-07-2022, 02:18 AM
RE: Proggies - by dbox - 03-03-2023, 09:14 PM
RE: Proggies - by bplus - 06-07-2022, 10:51 AM
RE: Proggies - by SierraKen - 06-09-2022, 07:04 PM
RE: Proggies - by bplus - 06-09-2022, 10:40 PM
RE: Proggies - by bplus - 06-22-2022, 02:59 PM
RE: Proggies - by vince - 06-23-2022, 08:04 PM
RE: Proggies - by SierraKen - 06-24-2022, 06:28 PM
RE: Proggies - by bplus - 07-13-2022, 06:19 PM
RE: Proggies - by bplus - 07-17-2022, 11:38 PM
RE: Proggies - by bplus - 07-19-2022, 07:16 PM
RE: Proggies - by vince - 07-22-2022, 10:40 PM
RE: Proggies - by dbox - 07-23-2022, 12:47 AM
RE: Proggies - by SierraKen - 07-23-2022, 05:16 PM
RE: Proggies - by bplus - 07-24-2022, 04:16 PM
RE: Proggies - by dbox - 07-24-2022, 11:33 PM
RE: Proggies - by SierraKen - 07-24-2022, 11:38 PM
RE: Proggies - by bplus - 09-19-2022, 07:16 PM
RE: Proggies - by bplus - 09-20-2022, 03:42 PM
RE: Proggies - by James D Jarvis - 09-21-2022, 12:22 PM
RE: Proggies - by bplus - 09-21-2022, 02:39 PM
RE: Proggies - by mnrvovrfc - 09-24-2022, 03:25 AM
RE: Proggies - by James D Jarvis - 09-21-2022, 02:55 PM
RE: Proggies - by bplus - 09-21-2022, 03:46 PM
RE: Proggies - by James D Jarvis - 09-21-2022, 05:46 PM
RE: Proggies - by bplus - 09-21-2022, 06:29 PM
RE: Proggies - by bplus - 10-09-2022, 08:17 PM
RE: Proggies - by vince - 10-09-2022, 09:20 PM
RE: Proggies - by bplus - 10-10-2022, 01:52 PM
RE: Proggies - by vince - 10-10-2022, 04:20 PM
RE: Proggies - by bplus - 10-18-2022, 02:54 PM
RE: Proggies - by bplus - 01-16-2023, 03:53 PM
RE: Proggies - by bplus - 01-16-2023, 03:59 PM
RE: Proggies - by bplus - 01-16-2023, 04:05 PM
RE: Proggies - by bplus - 01-16-2023, 04:09 PM
RE: Proggies - by bplus - 01-16-2023, 04:13 PM
RE: Proggies - by bplus - 01-17-2023, 08:18 PM
RE: Proggies - by bplus - 03-06-2023, 07:04 PM
RE: Proggies - by bplus - 03-24-2023, 02:41 AM
RE: Proggies - by vince - 03-24-2023, 05:22 AM
RE: Proggies - by bplus - 03-24-2023, 05:32 AM
RE: Proggies - by mnrvovrfc - 03-24-2023, 05:54 AM
RE: Proggies - by vince - 04-09-2023, 06:49 AM
RE: Proggies - by bplus - 04-09-2023, 03:05 PM
RE: Proggies - by bplus - 07-23-2023, 12:16 PM
RE: Proggies - by GareBear - 07-23-2023, 05:47 PM
RE: Proggies - by bplus - 07-23-2023, 07:35 PM
RE: Proggies - by bplus - 07-24-2023, 07:04 PM
RE: Proggies - by bplus - 07-24-2023, 07:09 PM
RE: Proggies - by bplus - 08-17-2023, 07:17 AM
RE: Proggies - by johnno56 - 08-17-2023, 10:32 AM
RE: Proggies - by bplus - 08-28-2023, 03:24 PM
RE: Proggies - by Dav - 08-28-2023, 05:28 PM
RE: Proggies - by PhilOfPerth - 08-28-2023, 11:47 PM
RE: Proggies - by johnno56 - 08-29-2023, 07:11 AM
RE: Proggies - by bplus - 08-29-2023, 12:39 PM
RE: Proggies - by bplus - 09-03-2023, 02:47 PM
RE: Proggies - by vince - 09-03-2023, 11:10 PM
RE: Proggies - by SMcNeill - 09-03-2023, 05:22 PM
RE: Proggies - by bplus - 09-03-2023, 05:41 PM
RE: Proggies - by bplus - 09-03-2023, 05:47 PM
RE: Proggies - by bplus - 09-03-2023, 11:21 PM
RE: Proggies - by Dav - 09-04-2023, 01:00 AM
RE: Proggies - by grymmjack - 09-06-2023, 12:14 AM
RE: Proggies - by bplus - 09-04-2023, 01:45 AM
RE: Proggies - by mrbcx - 09-05-2023, 03:22 AM
RE: Proggies - by bplus - 09-05-2023, 12:35 PM
RE: Proggies - by bplus - 09-08-2023, 10:24 PM
RE: Proggies - by Dav - 09-09-2023, 12:43 AM
RE: Proggies - by bplus - 09-21-2023, 06:42 PM
RE: Proggies - by bplus - 09-27-2023, 03:16 AM
RE: Proggies - by Dav - 10-05-2023, 08:24 PM
RE: Proggies - by bplus - 10-05-2023, 08:49 PM
RE: Proggies - by bplus - 10-08-2023, 02:13 PM
RE: Proggies - by Dav - 10-08-2023, 06:04 PM
RE: Proggies - by Dav - 10-08-2023, 11:56 PM
RE: Proggies - by bplus - 10-09-2023, 12:22 AM
RE: Proggies - by Dav - 10-09-2023, 12:59 AM
RE: Proggies - by PhilOfPerth - 10-09-2023, 05:28 AM
RE: Proggies - by mnrvovrfc - 10-09-2023, 10:58 AM
RE: Proggies - by Dav - 10-09-2023, 12:33 PM
RE: Proggies - by bplus - 10-09-2023, 05:37 PM
RE: Proggies - by Dav - 10-09-2023, 08:56 PM
RE: Proggies - by bplus - 10-09-2023, 09:23 PM
RE: Proggies - by Dav - 10-18-2023, 02:11 PM
RE: Proggies - by bplus - 10-18-2023, 07:40 PM
RE: Proggies - by CharlieJV - 10-19-2023, 02:28 AM
RE: Proggies - by bplus - 10-19-2023, 01:48 PM
RE: Proggies - by dbox - 10-19-2023, 02:16 PM
RE: Proggies - by dbox - 10-19-2023, 04:07 PM
RE: Proggies - by bplus - 10-19-2023, 05:23 PM
RE: Proggies - by bplus - 10-19-2023, 09:32 PM
RE: Proggies - by Dav - 10-19-2023, 11:45 PM
RE: Proggies - by bplus - 10-27-2023, 08:00 AM
RE: Proggies - by vince - 10-27-2023, 08:49 AM
RE: Proggies - by bplus - 10-27-2023, 01:32 PM
RE: Proggies - by GareBear - 10-28-2023, 05:16 PM
RE: Proggies - by bplus - 10-28-2023, 05:29 PM
RE: Proggies - by dbox - 10-28-2023, 10:19 PM
RE: Proggies - by bplus - 10-28-2023, 11:10 PM
RE: Proggies - by bplus - 10-29-2023, 11:03 AM
RE: Proggies - by bplus - 01-06-2024, 03:12 PM
RE: Proggies - by CharlieJV - 01-06-2024, 05:01 PM
RE: Proggies - by bplus - 01-29-2024, 04:30 PM
RE: Proggies - by PhilOfPerth - 01-29-2024, 11:24 PM
RE: Proggies - by bplus - 01-30-2024, 02:52 PM
RE: Proggies - by bplus - 03-17-2024, 07:11 PM
RE: Proggies - by bplus - 03-24-2024, 11:25 PM
RE: Proggies - by vince - 03-25-2024, 12:27 AM
RE: Proggies - by bplus - 03-26-2024, 06:33 PM
RE: Proggies - by bplus - 05-11-2024, 06:13 PM
RE: Proggies - by bplus - 06-14-2024, 01:58 AM
RE: Proggies - by PhilOfPerth - 06-14-2024, 06:01 AM
RE: Proggies - by NakedApe - 06-14-2024, 04:13 AM
RE: Proggies - by vince - 06-14-2024, 09:15 AM
RE: Proggies - by bplus - 06-14-2024, 10:42 PM
RE: Proggies - by Dav - 06-14-2024, 10:58 PM
RE: Proggies - by bplus - 06-19-2024, 10:14 PM
RE: Proggies - by madscijr - 06-20-2024, 12:41 PM
RE: Proggies - by Dav - 06-20-2024, 06:28 PM
RE: Proggies - by bplus - 06-20-2024, 06:45 PM
RE: Proggies - by dbox - 06-20-2024, 06:48 PM
RE: Proggies - by bplus - 06-20-2024, 07:40 PM
RE: Proggies - by bplus - 06-20-2024, 07:46 PM
RE: Proggies - by bplus - 06-27-2024, 01:09 PM
RE: Proggies - by Steffan-68 - 06-27-2024, 04:02 PM
RE: Proggies - by bplus - 06-27-2024, 04:09 PM
RE: Proggies - by Steffan-68 - 06-27-2024, 04:51 PM
RE: Proggies - by GareBear - 06-27-2024, 05:08 PM
RE: Proggies - by Steffan-68 - 06-27-2024, 05:21 PM
RE: Proggies - by bplus - 06-29-2024, 01:39 PM
RE: Proggies - by bplus - 07-01-2024, 11:30 PM
RE: Proggies - by SMcNeill - 07-02-2024, 12:59 AM
RE: Proggies - by bplus - 07-02-2024, 01:53 PM
RE: Proggies - by SMcNeill - 07-02-2024, 03:07 PM
RE: Proggies - by vince - 07-02-2024, 04:15 AM
RE: Proggies - by bplus - 07-02-2024, 02:02 PM
RE: Proggies - by bplus - 07-02-2024, 05:30 PM
RE: Proggies - by SMcNeill - 07-02-2024, 11:11 PM
RE: Proggies - by bplus - 07-02-2024, 11:30 PM
RE: Proggies - by bplus - 07-15-2024, 12:07 AM
RE: Proggies - by vince - 07-17-2024, 02:06 PM
RE: Proggies - by bplus - 07-17-2024, 02:39 PM
RE: Proggies - by vince - 07-17-2024, 03:34 PM
RE: Proggies - by Dav - 08-30-2024, 05:47 PM
RE: Proggies - by bplus - 08-30-2024, 05:57 PM
RE: Proggies - by Dav - 08-30-2024, 06:00 PM
RE: Proggies - by Dav - 10-02-2024, 01:06 PM
RE: Proggies - by bplus - 10-02-2024, 02:59 PM
RE: Proggies - by Dav - 10-02-2024, 04:31 PM
RE: Proggies - by bplus - 10-02-2024, 08:45 PM
RE: Proggies - by Dav - 10-02-2024, 09:05 PM
RE: Proggies - by NakedApe - 10-02-2024, 09:13 PM
RE: Proggies - by Dav - 10-03-2024, 07:31 PM
RE: Proggies - by bplus - 10-03-2024, 10:35 PM
RE: Proggies - by Dav - 10-03-2024, 11:04 PM
RE: Proggies - by madscijr - 10-07-2024, 08:08 PM
RE: Proggies - by bplus - 10-07-2024, 08:37 PM
RE: Proggies - by bplus - 11-01-2024, 09:28 PM
RE: Proggies - by PhilOfPerth - 11-01-2024, 11:04 PM
RE: Proggies - by bplus - 11-01-2024, 11:48 PM
RE: Proggies - by bplus - 11-09-2024, 01:21 AM
RE: Proggies - by PhilOfPerth - 11-09-2024, 07:48 AM
RE: Proggies - by vince - 11-09-2024, 03:38 PM
RE: Proggies - by bplus - 11-09-2024, 03:53 PM
RE: Proggies - by PhilOfPerth - 11-09-2024, 11:06 PM



Users browsing this thread: 14 Guest(s)