Post by Rod on Mar 3, 2022 12:57:55 GMT
Blah.. mazes and AI... sometimes some mindless fun is just as entertaining. To get the best from this move your mouse slowly round the screen and from time to time towards the lead ball.
nomainwin
WindowWidth=DisplayWidth
WindowHeight=DisplayHeight
graphicbox #1.g 0,0,DisplayWidth,DisplayHeight
open "" for window_popup as #1
#1.g "when characterInput [key] ; setfocus"
#1.g "when mouseMove [mouse]"
' make sprites
#1.g "down ; backcolor white ; color white"
#1.g "place 0 0 ; boxfilled 64 64"
#1.g "place 32 32 ; size 2"
#1.g "backcolor black ; circlefilled 32"
for m= 1 to 100
'random 24 bit color choice
r=int(rnd(0)*256)
g=int(rnd(0)*256)
b=int(rnd(0)*256)
'color fades from centre but not to 0
rr=r/300
gg=g/300
bb=b/300
#1.g "size 1"
#1.g "backcolor black ; color black"
#1.g "place 0 64 ; boxfilled 64 128"
#1.g "place 32 96 ; size 2"
'draw an ever increasing circle with decreasing color
for n= 8 to 255
#1.g "color ";r;" ";g;" ";b
#1.g "circle ";n/8
r=r-rr
g=g-gg
b=b-bb
next n
#1.g "getbmp b";m;" 0 0 64 128"
#1.g "addsprite s";m;" b";m
next
#1.g "fill black"
#1.g "getbmp bg 0 0 600 600"
#1.g "background bg"
'position 100 sprites
dim starPos(100, 5) 'x,y,dx,dy,dz
x=1
y=2
dx=3
dy=4
dz=5
#1.g "home ; posxy midX midY"
midX=midX-32
midY=midY-32
for n = 1 to 100
starPos(n,x)=midX
starPos(n,y)=midY
starPos(n,z)=100
starPos(n,dx)=20-rnd(0)*80+20
starPos(n,dy)=10-rnd(0)*40+10
starPos(n,dz)=rnd(0)*10+2
next
xdelta=rnd(0)*4
ydelta=rnd(0)*4
degreex=180
degreey=270
d=DisplayHeight/3
[draw]
scan
#1.g "drawsprites"
xx=Int((sin(degreex/57.29577951)*d)+midX)
degreex=degreex+xdelta
if degreex>359 then degreex=0 : xdelta=rnd(0)*4
yy=Int((sin(degreey/57.29577951)*d)+midY)
degreey=degreey+ydelta
if degreey>359 then degreey=0 : ydelta=rnd(0)*4
'move the sprites
for n=1 to 100
starPos(n,x)=starPos(n,x)+starPos(n,dx)+(XX-starPos(n,x))/10
starPos(n,y)=starPos(n,y)+starPos(n,dy)+(YY-starPos(n,y))/10
starPos(n,z)=starPos(n,z)+starPos(n,dz)
'start the sprite again if it is over the limit
if starPos(n,z)>200 then
starPos(n,x)=xx
starPos(n,y)=yy
starPos(n,z)=100
starPos(n,dx)=20-rnd(0)*80+20
starPos(n,dy)=10-rnd(0)*40+10
starPos(n,dz)=rnd(0)*10+2
end if
'scale the sprites, takes time!
#1.g "spritescale s";n;" ";starPos(n,z)
#1.g "spritexy s";n;" ";starPos(n,x);" ";starPos(n,y)
next
goto [draw]
[mouse]
XX=MouseX
YY=MouseY
goto [draw]
[key]
'drop to quit
[quit]
timer 0
close #1
end