
This code produces an effect similar to motion blur. You can modify the complexity of the blur and which object to blur by changing the designated varibles. By changing the gosubs, you can modify the effect. The blur will always use objects 1 to blurs+1. The blur only appears when your object is in motion, and fades out when it isn't.
The codes:
sync on
`how deatailed the blur will be
blurs=100
`the object that will be blurred
make object sphere 1,10
`setup the blur
gosub blur_setup
do
xrotate camera camera angle x()+mousemovey()
yrotate camera camera angle y()+mousemovex()
if upkey()=1 then move camera 1
if downkey()=1 then move camera -1
null=mousemovex()
null=mousemovey()
if returnkey()=0
if leftkey()=1 then yrotate object 1,object angle y(1)-1
if rightkey()=1 then yrotate object 1,object angle y(1)+1
if spacekey()=1 then move object 1,0.5
`put this in your main loop
gosub blur_loop
endif
sync
loop
blur_setup:
dim blurx#(blurs-1)
dim blury#(blurs-1)
dim blurz#(blurs-1)
dim blurax#(blurs-1)
dim bluray#(blurs-1)
dim bluraz#(blurs-1)
for n=2 to blurs+1
clone object n,n-1
scale object n,100-n,100-n,100-n
`rem next line to see different effect
set alpha mapping on n,int(100/n)
blurx#(n-2)=object position x(1)
blury#(n-2)=object position y(1)
blurz#(n-2)=object position z(1)
blurax#(n-2)=object angle x(1)
bluray#(n-2)=object angle y(1)
bluraz#(n-2)=object angle z(1)
next n
return
blur_loop:
blurx#(0)=object position x(1)
blury#(0)=object position y(1)
blurz#(0)=object position z(1)
blurax#(0)=object angle x(1)
bluray#(0)=object angle y(1)
bluraz#(0)=object angle z(1)
for t=blurs-1 to 1 step -1
blurx#(t)=blurx#(t-1)
blury#(t)=blury#(t-1)
blurz#(t)=blurz#(t-1)
blurax#(t)=blurax#(t-1)
bluray#(t)=bluray#(t-1)
bluraz#(t)=bluraz#(t-1)
next t
for t=1 to blurs
position object t,blurx#(t-1),blury#(t-1),blurz#(t-1)
rotate object t,blurax#(t-1),bluray#(t-1),bluraz#(t-1)
next t
return
Use the mouse and up/down arrow keys to move.
Ues left/right to turn the object.
Use space to move the object.
Hold enter to pause the object and blur.
Quote: "I've seen the word programming and I'm not sure what it means. Anybody please explain?"
Quote: "We shouldn't sacrifice the truth to preserve "balance"."