Shadow Comeing off a word
Author |
Message |
The_Bean
|
Posted: Sat Dec 08, 2007 12:32 am Post subject: Shadow Comeing off a word |
|
|
Casts a Shdaow off of a word and the sun is your mouse so the shadow comes off opposite to your mouse.
Uses math and trig.
1 or 2 glitches that i know of because of tan=y/x so 90 degrees causes an error so i had to bypass that which causes a small glitch and for a similar reason theres another at 180. Im working on fixing them but no succes yet. And i didn't comment it.
The original one that i made of this was for my class mates. Without having them do anything it new what there name was (which was kind of creepy) and put it in the middle of the screen, but it only works at scool computers so i had to remove that feature for this version.
Turing: |
setscreen("graphics:max,max")
var name : string
put "Please enter your name or a word or something: "..
get name
setscreen("offscreenonly")
var xm,ym,bm : int
var sx,sy,sr : int
var degree : real:= 0
var font: int := Font.New ("serif:40")
loop
Mouse.Where(xm,ym,bm )
xm: = xm- maxx div 2
ym:=ym - maxy div 2
if xm not = 0 then
degree: = arctand(abs(ym )/ abs(xm ))
end if
if xm = 0 then
degree:= 90
end if
sr:= round(sqrt(xm** 2+ym** 2))div 2
if xm> 0 and ym>= 0 then
degree+= 0
end if
if xm< 0 and ym> 0 then
degree:= 180-degree
end if
if xm< 0 and ym< 0 then
degree+= 180
end if
if xm>= 0 and ym<= 0 then
degree:= 360-degree
end if
locate(1, 1)
put degree
degree-= 180
cls
Mouse.Where(xm,ym,bm )
Draw.FillOval(xm,ym, 50, 50, 44)
for decreasing i:sr .. 1
sx:= round(maxx div 2+i* cosd(degree ))
sy:= round(maxy div 2+i* sind(degree ))
Font.Draw (name,sx - Font.Width (name, font )div 2,sy- 15, font, 7)
end for
Font.Draw (name,sx - Font.Width (name, font )div 2,sy- 15, font, 3)
View.Update
exit when hasch
end loop
|
I know the sun should have been infront of the letters but it blocks them out when you go over top which doesn't look to good so i put it behind. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Sean
|
Posted: Sat Dec 08, 2007 9:13 am Post subject: Re: Shadow Comeing off a word |
|
|
I like the concept, but needs Documentation, better variable names so we know what exactly each variable does. |
|
|
|
|
|
|
|