Author Topic: Sonar  (Read 1204 times)

Galileo

  • Guest
Sonar
« on: February 27, 2017, 06:08:55 PM »
Code: [Select]
// Galileo, 02/2017, Yabasic 2.78.0

w=150 : h=150
open window w, h
backcolor 0,0,0
clear window

dim fondo(w,h)

for n=1 to w*h/4
fondo(ran(w),ran(h)) = 1
next n
px=w/2 : py=0

do
color 0,0,0
fill rectangle w-15,0,w,h
for x=0 to w
for y=0 to h
c = 255
for nx = x to x-15 step -1
color c,c,c
if nx > 0 and fondo(nx,y) dot nx,y
c=c/1.25
next nx
if  x=px and y=py then beep : blanco(1) end if
next y
blanco(0)
next x
loop


sub blanco(c)
static cp

if c cp = 255

if cp > 0 then
color cp,cp,cp
fill circle px,py,4
cp = cp - 2
elseif cp <> -100
py = py + 10
if py > h py =0
cp = -100
end if
end sub

Aurel

  • Guest
Re: Sonar
« Reply #1 on: February 27, 2017, 07:09:13 PM »
simple and funny  :)