Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Shadow Comeing off a word
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
The_Bean




PostPosted: 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
Sponsor
sponsor
Sean




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: