10-16-2022, 12:13 AM
It's a problem with your numbers exceeding type limits. The variable bang never gets lowered, it only goes higher until it errors out.
For fun, I reset the variable to zero, to make a race track simulation...
Jut get rid of my bang = 0 ' JUST FOR FUR RACE TRACK EFFECT... and watch the counter I put in. When it errors, it displays a bogus scientific number notation, and the ball freezes.
I hope that is of some help.
Pete
For fun, I reset the variable to zero, to make a race track simulation...
Code: (Select All)
DIM bv AS _INTEGER64
'caveball
ms& = _NEWIMAGE(800, 600, 32)
border& = _NEWIMAGE(800, 600, 32)
RANDOMIZE TIMER
DIM c1 AS LONG
DIM klr AS _UNSIGNED LONG
DIM empty AS _UNSIGNED LONG
SCREEN border&
c1 = _RGB(255, 255, 255)
x1 = 50
y1 = 50
flag = 0
WHILE flag = 0
x2 = (RND * 80) + 80 + x1
IF x2 > 750 THEN
x2 = 750
flag = 1
END IF
y2 = RND * 60 + 20
fatline x1, y1, x2, y2, 2, c1
x1 = x2
y1 = y2
WEND
flag = 0
WHILE flag = 0
y2 = (RND * 80) + 80 + y1
IF y2 > 550 THEN
y2 = 550
flag = 1
END IF
x2 = 750 - (RND * 60 + 20)
fatline x1, y1, x2, y2, 2, c1
x1 = x2
y1 = y2
WEND
flag = 0
WHILE flag = 0
x2 = x1 - ((RND * 80) + 80)
IF x2 < 50 THEN
x2 = 50
flag = 1
END IF
y2 = 550 - (RND * 60 + 20)
fatline x1, y1, x2, y2, 2, c1
x1 = x2
y1 = y2
WEND
flag = 0
WHILE flag = 0
y2 = y1 - ((RND * 80) + 80)
IF y2 < 50 THEN
y2 = 50
flag = 1
END IF
x2 = RND * 60 + 20
IF flag = 1 THEN x2 = 50
fatline x1, y1, x2, y2, 2, c1
x1 = x2
y1 = y2
WEND
bx = 400
by = 400
speed = 2
SCREEN ms&
bang = 11
DO
_LIMIT 60
CLS
LOCATE 1, 1: PRINT bx; by; bv; " ";
_PUTIMAGE , border&, ms&
bang = bang + bm
bx = bx + speed * COS(0.01745329 * bang)
by = by + speed * SIN(0.01745329 * bang)
bm = 0
FOR bv = bang - 120 TO bang + 120 STEP 10
checkx = bx + (12 * bang / bv) * COS(0.01745329 * bv)
checky = by + (12 * bang / bv) * SIN(0.01745329 * bv)
klr = POINT(checkx, checky)
IF klr = c1 AND bm = 0 THEN
bm = bm + bv
END IF
NEXT
bang = 0 ' JUST FOR FUR RACE TRACK EFFECT...
CIRCLE (bx, by), 10, c1
_DISPLAY
kk$ = INKEY$
LOOP UNTIL kk$ = CHR$(27)
SUB circleBF (cx AS LONG, cy AS LONG, r AS LONG, klr AS _UNSIGNED LONG)
rsqrd = r * r
y = -r
WHILE y <= r
x = SQR(rsqrd - y * y)
LINE (cx - x, cy + y)-(cx + x, cy + y), klr, BF
y = y + 1
WEND
END SUB
SUB fatline (x0, y0, x1, y1, r, klr AS _UNSIGNED LONG)
IF ABS(y1 - y0) < ABS(x1 - x0) THEN
IF x0 > x1 THEN
lineLow x1, y1, x0, y0, r, klr
ELSE
lineLow x0, y0, x1, y1, r, klr
END IF
ELSE
IF y0 > y1 THEN
lineHigh x1, y1, x0, y0, r, klr
ELSE
lineHigh x0, y0, x1, y1, r, klr
END IF
END IF
END SUB
SUB lineLow (x0, y0, x1, y1, r, klr AS _UNSIGNED LONG)
dx = x1 - x0
dy = y1 - y0
yi = 1
IF dy < 0 THEN
yi = -1
dy = -dy
END IF
'D = (2 * dy) - dx
d = (dy + dy) - dx
y = y0
FOR x = x0 TO x1
circleBF x, y, r, klr
IF d > 0 THEN
y = y + yi
' D = D + (2 * (dy - dx))
d = d + ((dy - dx) + (dy - dx))
ELSE
' D = D + 2 * dy
d = d + dy + dy
END IF
NEXT x
END SUB
SUB lineHigh (x0, y0, x1, y1, r, klr AS _UNSIGNED LONG)
dx = x1 - x0
dy = y1 - y0
xi = 1
IF dx < 0 THEN
xi = -1
dx = -dx
END IF
' D = (2 * dx) - dy
D = (dx + dx) - dy
x = x0
FOR y = y0 TO y1
circleBF x, y, r, klr
IF D > 0 THEN
x = x + xi
' D = D + (2 * (dx - dy))
D = D + ((dx - dy) + (dx - dy))
ELSE
' D = D + 2 * dx
D = D + dx + dx
END IF
NEXT y
END SUB
Jut get rid of my bang = 0 ' JUST FOR FUR RACE TRACK EFFECT... and watch the counter I put in. When it errors, it displays a bogus scientific number notation, and the ball freezes.
I hope that is of some help.
Pete
If eggs are brain food, Biden takes his scrambled.