Once again Charlie's post inspires b+ to dig into his files and pull out a better version in his opinion of course
Compare this to Charlie's Clay Pigeon
https://qb64phoenix.com/forum/showthread...3#pid17053
Looks like I should pull a Terry Richie and cleanup and comment code for teaching purposes, stay tuned...
Compare this to Charlie's Clay Pigeon
https://qb64phoenix.com/forum/showthread...3#pid17053
Code: (Select All)
W = 800: H = 600 ' b+ updated 2023-06-23
Screen _NewImage(800, 600, 32)
a:
Cls
a = Rnd * W: b = 0: c = Rnd * 6 - 3: d = Rnd * 3 + 3: u = 0: v = 0: x = 400: y = H
Do
_Title "Click mouse to intersect incoming MC hits:" + Str$(t) + ", misses:" + Str$(m)
_PrintString (400, 594), "^"
While _MouseInput: Wend
If _MouseButton(1) Then e = _MouseX - 400: f = _MouseY - H: z = (e ^ 2 + f ^ 2) ^ .5: u = 5 * e / z: v = 5 * f / z
x = x + u: y = y + v: a = a + c: b = b + d
If x < 0 Or y < 0 Or a < 0 Or b < 0 Or x > W Or a > W Or b > H Then
If b > H Or x < 0 Or y < 0 Or x > W Then m = m + 1
GoTo a:
End If
If ((x - a) ^ 2 + (y - b) ^ 2) ^ .5 < 30 Then
For r = 1 To 20 Step 4
Circle ((x + a) / 2, (y + b) / 2), r
_Limit 60
Next
t = t + 1: GoTo a:
Else
PSet (x, y): PSet (a, b)
End If
_Limit 20
Loop
Looks like I should pull a Terry Richie and cleanup and comment code for teaching purposes, stay tuned...
b = b + ...