Pollution! Tiny program, which should run in about any Basic
-
- Posts: 814
- Joined: Tue Apr 09, 2013 12:23 pm
- My devices: iPhone,iPad
Windows - Location: Groningen, Netherlands
- Flag:
Pollution! Tiny program, which should run in about any Basic
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
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
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Pollution! Tiny program, which should run in about any B
Very cool and stylish!
I made a modification - added colors:
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
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Pollution! Tiny program, which should run in about any B
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
-
- Posts: 814
- Joined: Tue Apr 09, 2013 12:23 pm
- My devices: iPhone,iPad
Windows - Location: Groningen, Netherlands
- Flag:
Re: Pollution! Tiny program, which should run in about any B
Awfull! But the colors are too nice to represent dirty pollution. On my machine mc is set back to 0.4
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Pollution! Tiny program, which should run in about any B
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
Well, I thought that with darkening by shadow, bright colors will look quite appealingHenko wrote:Awfull! But the colors are too nice to represent dirty pollution. On my machine mc is set back to 0.4
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
-
- Posts: 814
- Joined: Tue Apr 09, 2013 12:23 pm
- My devices: iPhone,iPad
Windows - Location: Groningen, Netherlands
- Flag:
Re: Pollution! Tiny program, which should run in about any B
Yes, I agree. "Awfull" was the wrong word (English not beiing my mother language).Kibernetik wrote:Attempt to make speed more equal on different devices.
Well, I thought that with darkening by shadow, bright colors will look quite appealingHenko wrote:Awfull! But the colors are too nice to represent dirty pollution. On my machine mc is set back to 0.4
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?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Pollution! Tiny program, which should run in about any B
New version. Transparency added for more subtle color effect.
Yes, it is a good idea to make hardware identification...
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
- Фант
- Posts: 1363
- Joined: Sat Nov 30, 2013 10:01 am
- My devices: iPad 4 (iOS 9.3), iMac (MAC OS 11.03)
- Location: Россия,Санкт-Петербург
- Flag:
- Contact:
Re: Pollution! Tiny program, which should run in about any B
Отличная программа!
Моя версия для iPad 4:
Моя версия для 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
- Attachments
-
- image.jpg (2.23 MiB) Viewed 5942 times
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Pollution! Tiny program, which should run in about any Basic
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