Page 1 of 2
Pollution! Tiny program, which should run in about any Basic
Posted: Sun Mar 16, 2014 2:54 pm
by Henko
graphics ! graphics clear .8,.8,.8
sw=screen_width() ! cx=sw/2 ! sh=screen_height() ! cy=sh/2
draw color 0,.5,0 ! draw font size sw/20
draw text "POLLUTION !" at 100,cy ! draw color 0,0,0
option angle degrees
s=3
randomize ! xo=cx ! yo=cy !
anew: draw to xo,yo
loop:
ang=rnd(360) ! x=xo+s*cos(ang) ! y=yo+s*sin(ang)
if x<0 or x>sw then ! xo=cx ! goto anew ! end if
if y<0 or y>sh then ! yo=cy ! goto anew ! end if
draw line to x,y ! xo=x ! yo=y
if sh=524 then pause .003 ' slow down 5S iPhone
goto loop
end
Re: Pollution! Tiny program, which should run in about any B
Posted: Sun Mar 16, 2014 3:14 pm
by Mr. Kibernetik
Very cool and stylish!
I made a modification - added colors:
Code: Select all
' Pollution!
' by Henko, 2014
' version 1.1
' mod by Mr.K
graphics ! graphics clear .8,.8,.8
sw=screen_width() ! cx=sw/2 ! sh=screen_height() ! cy=sh/2
draw color 0,.5,0 ! draw font size sw/20
draw text "POLLUTION !" at 100,cy ! draw color 0,0,0
option angle degrees
s=3 ! mc=0.4
randomize ! xo=cx ! yo=cy !
anew: draw to xo,yo
draw color rnd(mc),rnd(mc),rnd(mc)
loop:
ang=rnd(360) ! x=xo+s*cos(ang) ! y=yo+s*sin(ang)
if x<0 or x>sw then ! xo=cx ! goto anew ! end if
if y<0 or y>sh then ! yo=cy ! goto anew ! end if
draw line to x,y ! xo=x ! yo=y
if sh=524 then pause .003 ' slow down 5S iPhone
goto loop
end
Re: Pollution! Tiny program, which should run in about any B
Posted: Sun Mar 16, 2014 9:55 pm
by Mr. Kibernetik
New mod, now Pollution in 3D
and colors are more vivid.
Code: Select all
' Pollution!
' version 1.2
' by Henko, 2014
' mod by Mr.K
shadow on
graphics ! graphics clear .8,.8,.8
sw=screen_width() ! cx=sw/2 ! sh=screen_height() ! cy=sh/2
draw color 0,.5,0 ! draw font size sw/20
draw text "POLLUTION !" at 100,cy ! draw color 0,0,0
option angle degrees ! option screenlock off
s=3 ! mc=1
randomize ! xo=cx ! yo=cy !
anew: draw to xo,yo
draw color rnd(mc),rnd(mc),rnd(mc)
loop:
ang=rnd(360) ! x=xo+s*cos(ang) ! y=yo+s*sin(ang)
if x<0 or x>sw then ! xo=cx ! goto anew ! end if
if y<0 or y>sh then ! yo=cy ! goto anew ! end if
draw line to x,y ! xo=x ! yo=y
if sh=524 then pause .003 ' slow down 5S iPhone
goto loop
end
Re: Pollution! Tiny program, which should run in about any B
Posted: Sun Mar 16, 2014 10:38 pm
by Henko
Awfull! But the colors are too nice to represent dirty pollution. On my machine mc is set back to 0.4
Re: Pollution! Tiny program, which should run in about any B
Posted: Sun Mar 16, 2014 10:49 pm
by Mr. Kibernetik
Attempt to make speed more equal on different devices.
Code: Select all
' Pollution!
' version 1.3
' by Henko, 2014
' mod by Mr.K
timer reset
for i=0 to 1000 ! next i
if timer()<1 then pause=1
shadow on
graphics ! graphics clear .8,.8,.8
sw=screen_width() ! cx=sw/2 ! sh=screen_height() ! cy=sh/2
draw color 0,.5,0 ! draw font size sw/20
draw text "POLLUTION !" at 100,cy ! draw color 0,0,0
option angle degrees ! option screenlock off
s=3 ! mc=1
randomize ! xo=cx ! yo=cy !
anew: draw to xo,yo
draw color rnd(mc),rnd(mc),rnd(mc)
loop:
ang=rnd(360) ! x=xo+s*cos(ang) ! y=yo+s*sin(ang)
if x<0 or x>sw then ! xo=cx ! goto anew ! end if
if y<0 or y>sh then ! yo=cy ! goto anew ! end if
draw line to x,y ! xo=x ! yo=y
if pause then pause 0.0005 'slow down
goto loop
end
Henko wrote:Awfull! But the colors are too nice to represent dirty pollution. On my machine mc is set back to 0.4
Well, I thought that with darkening by shadow, bright colors will look quite appealing
Re: Pollution! Tiny program, which should run in about any B
Posted: Sun Mar 16, 2014 10:55 pm
by Mr. Kibernetik
- Снимок экрана 17 марта 2014 г., 4.54.00 с Симулятора iOS.jpg (164.81 KiB) Viewed 6173 times
Re: Pollution! Tiny program, which should run in about any B
Posted: Mon Mar 17, 2014 9:00 am
by Henko
Kibernetik wrote:Attempt to make speed more equal on different devices.
Henko wrote:Awfull! But the colors are too nice to represent dirty pollution. On my machine mc is set back to 0.4
Well, I thought that with darkening by shadow, bright colors will look quite appealing
Yes, I agree. "Awfull" was the wrong word (English not beiing my mother language).
The 3D shadow and the collors are a big improvement.
By the way, is there any means to check on which hardware an SB program is running? Could an SB statement for that purpose be possible?
Re: Pollution! Tiny program, which should run in about any B
Posted: Mon Mar 17, 2014 10:48 pm
by Mr. Kibernetik
New version. Transparency added for more subtle color effect.
Code: Select all
' Pollution!
' version 1.4
' by Henko, 2014
' mod by Mr.K
timer reset
for i=0 to 1000 ! next i
if timer()<1 then pause=1
shadow on
graphics ! graphics clear .8,.8,.8
sw=screen_width() ! cx=sw/2 ! sh=screen_height() ! cy=sh/2
draw color 0,.5,0 ! draw font size sw/20
draw text "POLLUTION !" at 100,cy ! draw color 0,0,0
option angle degrees ! option screenlock off
s=3 ! mc=1
randomize ! xo=cx ! yo=cy !
anew: draw to xo,yo
draw color rnd(mc),rnd(mc),rnd(mc)
draw alpha rnd(.5)+.5
loop:
ang=rnd(360) ! x=xo+s*cos(ang) ! y=yo+s*sin(ang)
if x<0 or x>sw then ! xo=cx ! goto anew ! end if
if y<0 or y>sh then ! yo=cy ! goto anew ! end if
draw line to x,y ! xo=x ! yo=y
if pause then pause 0.0005 'slow down
goto loop
end
Yes, it is a good idea to make hardware identification...
Re: Pollution! Tiny program, which should run in about any B
Posted: Sun Sep 14, 2014 9:36 pm
by Фант
Отличная программа!
Моя версия для iPad 4:
Code: Select all
shadow on
option image pos central
option sprite pos central
option text pos central
graphics
graphics clear 1,1,1
draw font name "Palatino"
sw=screen_width() ! cx=sw/2 ! sh=screen_height() ! cy=sh/2
draw font size sw/8
t$="smart BASIC"
sprite 1 begin TEXT_WIDTH (T$),TEXT_HEIGHT (T$)
draw text t$ at TEXT_WIDTH (T$)/2,TEXT_HEIGHT (T$)/2
sprite end
sprite 1 at cx,cy
sprite 1 show
option angle degrees ! option screenlock off
s=3 ! mc=1
randomize ! xo=cx ! yo=cy !
anew: timer reset
5 if timer()>3000 then 10
xo=rnd(sw) ! yo=rnd(sh)
GET PIXEL xo*SCREEN_SCALE (),yo*SCREEN_SCALE () COLOR R,G,B
if r<1 and g<1 and b<1 then 5
draw to xo,yo
draw color rnd(mc),rnd(mc),rnd(mc)
draw alpha rnd(.5)+.5
loop:
if timer()>1000 then anew
ang=rnd(360) ! x=xo+s*cos(ang) ! y=yo+s*sin(ang)
if x<0 or x>sw then ! xo=cx ! goto anew ! end if
if y<0 or y>sh then ! yo=cy ! goto anew ! end if
draw line to x,y ! xo=x ! yo=y
if pause then pause 0.0005 'slow down
goto loop
10
sprite 1 hide
loop1:
draw color rnd(mc),rnd(mc),rnd(mc)
draw text t$ at cx,cy
goto loop1
Re: Pollution! Tiny program, which should run in about any Basic
Posted: Sat Mar 19, 2016 3:01 pm
by Mr. Kibernetik
This is my next modification of the program:
Code: Select all
' Pollution!
' version 1.5
' by Henko, 2014
' mod by Mr.K
SHADOW ON
GRAPHICS ! GRAPHICS CLEAR
sw=SCREEN_WIDTH() ! cx=sw/2 ! sh=SCREEN_HEIGHT() ! cy=sh/2
DRAW COLOR 0,.5,0 ! DRAW FONT SIZE sw/20
DRAW TEXT "POLLUTION !" AT 100,cy ! DRAW COLOR 0,0,0
OPTION ANGLE DEGREES ! OPTION SCREENLOCK OFF
s=3 ! mc=1
RANDOMIZE ! xo=cx ! yo=cy !
anew: DRAW TO xo,yo
DRAW COLOR RND(mc),RND(mc),RND(mc)
DRAW ALPHA RND(.5)+.5
DRAW SIZE RND(.8)+.2
LOOP:
ang=RND(360) ! x=xo+s*COS(ang) ! y=yo+s*SIN(ang)
IF x<0 OR x>sw THEN ! xo=cx ! GOTO anew ! END IF
IF y<0 OR y>sh THEN ! yo=cy ! GOTO anew ! END IF
DRAW LINE TO x,y ! xo=x ! yo=y
GOTO LOOP