_TITLE "Crop Circles #3 Mod 2 Blender" 'b+ trans and mod to QB64 2021-01-25
CONST Xmax
= 1024, Ymax
= 730, Cx
= Xmax
/ 2, Cy
= Ymax
/ 2, nCrops
= 4 HighColr
= _RGB32(240, 220, 80): LowColr
= _RGB32(100, 50, 10)crop0
drawShip mx, my, LowColr
PLC mx, my, Cx, Cy, 360
FlagChange = -1
crop3
cNum
= (cNum
+ 1) MOD nCrops
FlagChange = 0
'crop0 uses this
cr
= .5 * SQR((Cx
- mx
) ^ 2 + (Cy
- my
) ^ 2): m
= .5 * cr
dx = (mx - Cx) / m: dy = (my - Cy) / m: dr = cr / m
x = Cx + dx * (m - i): y = Cy + dy * (m - i): r = dr * i
fcirc x, y, r, cc
Radius
= ABS(R
): RadiusError
= -Radius: X
= Radius: Y
= 0 LINE (CX
- X
, CY
)-(CX
+ X
, CY
), C
, BF
RadiusError = RadiusError + Y * 2 + 1
LINE (CX
- Y
, CY
- X
)-(CX
+ Y
, CY
- X
), C
, BF
LINE (CX
- Y
, CY
+ X
)-(CX
+ Y
, CY
+ X
), C
, BF
X = X - 1
RadiusError = RadiusError - X * 2
Y = Y + 1
LINE (CX
- X
, CY
- Y
)-(CX
+ X
, CY
- Y
), C
, BF
LINE (CX
- X
, CY
+ Y
)-(CX
+ X
, CY
+ Y
), C
, BF
SUB PLC
(baseX
, baseY
, targetX
, targetY
, targetR
) ' PLC for PlasmaLaserCannon ta
= _ATAN2(targetY
- baseY
, targetX
- baseX
) ' angle of target to cannon base dist
= _HYPOT(targetY
- baseY
, targetX
- baseX
) ' distance cannon to target dr = targetR / dist
c = c + .3
fcirc x
, y
, dr
* r
, _RGB32(128 + 127 * SIN(r
* c
), 128 + 127 * SIN(g
* c
), 128 + 127 * SIN(b
* c
)) c = c + 1
LowColr
= _RGB32(128 + 127 * SIN(r
* c
), 128 + 127 * SIN(g
* c
), 128 + 127 * SIN(b
* c
)) fcirc x, y, rr, LowColr
cAnalysis LowColr, rr, gg, bb, aa
HighColr
= _RGB32(255 - rr
, 255 - gg
, 255 - bb
)
' PLC uses this
SUB drawShip
(x
, y
, colr
AS _UNSIGNED LONG) 'shipType collisions same as circle x, y radius = 30 fellipse x
, y
, 6, 15, _RGB32(r
, g
- 120, b
- 100) fellipse x
, y
, 18, 11, _RGB32(r
, g
- 60, b
- 50) fellipse x
, y
, 30, 7, _RGB32(r
, g
, b
) fcirc x
- 30 + 11 * light
+ ls
, y
, 1, _RGB32(ls
* 50, ls
* 50, ls
* 50) ls = ls + 1
' drawShip needs
w2 = xr * xr: h2 = yr * yr: h2w2 = h2 * w2
LINE (CX
- xr
, CY
)-(CX
+ xr
, CY
), C
, BF
y = y + 1
x
= SQR((h2w2
- y
* y
* w2
) \ h2
) LINE (CX
- x
, CY
+ y
)-(CX
+ x
, CY
+ y
), C
, BF
LINE (CX
- x
, CY
- y
)-(CX
+ x
, CY
- y
), C
, BF
rand
= RND * (high
- low
) + low
n = 12: stp = -40
shft = shft + 720 / (n * n)
x
= Cx
+ br
* COS(_D2R(i
* 360 / n
+ shft
)) y
= Cy
+ br
* SIN(_D2R(i
* 360 / n
+ shft
)) drawc x, y
ga = 137.5: bn = 800
br = 9.5: lr = .5: r = br: dr = (br - lr) / bn
hc = 180: lc = 120: cr = (hc - lc) / bn
r = r - dr
fcirc x, y, r, LowColr
'this needs big constrast of color
LINE (i
, 0)-(i
+ 10, Ymax
), LowColr
, BF
LINE (0, i
)-(Xmax
, i
+ 10), LowColr
, BF
fcirc x, y, 10, LowColr
r0 = rand(1, 5) / 5: r1 = rand(1, 5) / 10: r2 = rand(1, 5) / 10
fc = rand(1, 200) / 10: st = rand(10, 500) / 1000
xol = 0
yol = 0
mol = 0
a0
= (i
/ r0
) * (2 * _PI) a1
= ((i
/ r1
) * (2 * _PI)) * -1 x1
= Cx
+ (SIN(a0
) * ((r0
- r1
) * fc
)) * 30 y1
= Cy
+ (COS(a0
) * ((r0
- r1
) * fc
)) * 30 x2
= x1
+ (SIN(a1
) * ((r2
) * fc
)) * 30 y2
= y1
+ (COS(a1
) * ((r2
) * fc
)) * 30 mol = 1
xol = x2
yol = y2
LINE (xol
, yol
)-(x2
, y2
), LowColr
xol = x2
yol = y2