Thread: Analog Clock
View Single Post
  #1  
Old 03-11-2009, 12:32 PM
Tyhm Tyhm is offline
Psionic Youth
Tyhm's Avatar
Join Date: Mar 2001
Location: Babord, West Graal Deaths:1009 Kills:1
Posts: 5,635
Tyhm has a spectacular aura about
Analog Clock

PHP Code:
if (playerenters||timeout) {
  
showimg 0,insom_gui-watch.png,screenwidth-105,0;
  
changeimgvis 0,4;

  
temp.thp=(temp.thp-1)%1201;

  
setarray temp.points,8;

  
temp.cx=screenwidth-52;
  
temp.cy=52;
  
temp.h=30;
  
temp.radian=(pi*temp.thp/50);
  
temp.points[0]=temp.cx+(sin(temp.radian)*4);
  
temp.points[1]=temp.cy+(cos(temp.radian)*4);
  
temp.points[2]=temp.cx-(cos(temp.radian)*1);
  
temp.points[3]=temp.cy+(sin(temp.radian)*1);
  
temp.points[4]=temp.cx-(sin(temp.radian)*temp.h);
  
temp.points[5]=temp.cy-(cos(temp.radian)*temp.h);
  
temp.points[6]=temp.cx+(cos(temp.radian)*1);
  
temp.points[7]=temp.cy-(sin(temp.radian)*1);
  
showpoly 1,temp.points;
  
changeimgvis 1,6;
  
changeimgcolors 1,0.1,0.1,0.1,1;
  
temp.h+=4;
  
temp.points[0]=temp.cx+(sin(temp.radian)*5);
  
temp.points[1]=temp.cy+(cos(temp.radian)*5);
  
temp.points[2]=temp.cx-(cos(temp.radian)*2);
  
temp.points[3]=temp.cy+(sin(temp.radian)*2);
  
temp.points[4]=temp.cx-(sin(temp.radian)*temp.h);
  
temp.points[5]=temp.cy-(cos(temp.radian)*temp.h);
  
temp.points[6]=temp.cx+(cos(temp.radian)*2);
  
temp.points[7]=temp.cy-(sin(temp.radian)*2);
  
showpoly 2,temp.points;
  
changeimgvis 2,5;
  
changeimgcolors 2,0.5,0.5,0.5,0.25;

  
temp.h=20;
  
temp.radian=(pi*temp.thp/600);
  
temp.points[0]=temp.cx+(sin(temp.radian)*4);
  
temp.points[1]=temp.cy+(cos(temp.radian)*4);
  
temp.points[2]=temp.cx-(cos(temp.radian)*2);
  
temp.points[3]=temp.cy+(sin(temp.radian)*2);
  
temp.points[4]=temp.cx-(sin(temp.radian)*temp.h);
  
temp.points[5]=temp.cy-(cos(temp.radian)*temp.h);
  
temp.points[6]=temp.cx+(cos(temp.radian)*2);
  
temp.points[7]=temp.cy-(sin(temp.radian)*2);
  
showpoly 3,temp.points;
  
changeimgvis 3,6;
  
changeimgcolors 3,0.1,0.1,0.1,1;
  
temp.h+=4;
  
temp.points[0]=temp.cx+(sin(temp.radian)*5);
  
temp.points[1]=temp.cy+(cos(temp.radian)*5);
  
temp.points[2]=temp.cx-(cos(temp.radian)*3);
  
temp.points[3]=temp.cy+(sin(temp.radian)*3);
  
temp.points[4]=temp.cx-(sin(temp.radian)*temp.h);
  
temp.points[5]=temp.cy-(cos(temp.radian)*temp.h);
  
temp.points[6]=temp.cx+(cos(temp.radian)*3);
  
temp.points[7]=temp.cy-(sin(temp.radian)*3);
  
showpoly 4,temp.points;
  
changeimgvis 4,5;
  
changeimgcolors 4,0.5,0.5,0.5,0.25;
  
timeout=0.05;

I'm sure a clever coder could make a for loop for the points, but I like it my way. Replace temp.thp with the number of minutes you wish to reflect. Adding a second hand is left as an exercise for the reader. (Hint: You could probably just increment temp.thp by 1/60.)
Attached Images
 
__________________
"Whatever," said Bean, "I was just glad to get out of the toilet."

"Power does not corrupt. Fear corrupts, perhaps the fear of a loss of power."- John Steinbeck
"I'm only acting retarded, what's your excuse?" queried the Gord.
- My pet, the Levelup Gnome

http://forums.graalonline.com/forums...&postcount=233
Reply With Quote