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

Username:   Password: 
 RegisterRegister   
 Help with rotating lines
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Dundertaker




PostPosted: Sat Jun 07, 2008 10:13 am   Post subject: Help with rotating lines

Hi, im making an elevator program (pretty noobish, i know) and i need help rotating the arrow at the top of the elevator
Everytime i use this code, the arrow goes of the picture as if there is someting blocking its path.
It starts of at a 90degree angle but then it goes of the picture and come back out after 270 degrees of turning. I only want it to turn 180 degrees. Help Please
code:

View.Set ("graphics:500;500")
var f : int := Font.New ("Serif:36")
var eleavatorarrow : int
elevatorarrow := Pic.FileNew ("elevatorarrow.bmp")

%I drew more than one line in order to make it look like one thick line
Draw.Line (105,105,105,175,red)
Draw.Line (106,105,106,176,red)
Draw.Line (107,105,107,177,red)
Draw.Line (108,105,108,178,red)


%This is Just so i can see where the line is. Only for testing purposes
delay (1000)
%I tried to make this pic as tight as possible because i will be using other pictures in the real program
var pic : int := Pic.New (105, 105, 108,178)
loop
%This is in order to clear the screen of the previous line
cls
for i : 1..360
var pic90 : int := Pic.Rotate (pic, i, 1, 1)

Pic.Draw (pic90, 150, 150, picCopy)
delay(10)
cls
end for
end loop
Sponsor
Sponsor
Sponsor
sponsor
Sean




PostPosted: Sat Jun 07, 2008 11:33 am   Post subject: Re: Help with rotating lines

Turing:

%I drew more than one line in order to make it look like one thick line
Draw.Line (105,105,105,175,red)
Draw.Line (106,105,106,176,red)
Draw.Line (107,105,107,177,red)
Draw.Line (108,105,108,178,red)


Why?

Use Draw.ThickLine if you want a thickline instead of drawing four lines to make it look like one.

Turing:

for y : 100 .. 140
    delay (50)
    cls
    Draw.ThickLine (100, 100, y, 120, 10, black)
end for


Here is a basic rotating line. I know I could have done better, but I can't just give it to you.
Dundertaker




PostPosted: Sun Jun 08, 2008 8:45 pm   Post subject: RE:Help with rotating lines

I dont mean rotating like the one you have, yours resizes, i dont want that, i want it to stay the same and rotate, like the arrow in old fashioned elevators that shows what floors the elevator is in. The arrow just turns 180 degrees, thats what i want, i can make it rotate but the problem is it doesnt rotate 180 only 90.
Insectoid




PostPosted: Mon Jun 09, 2008 8:00 am   Post subject: RE:Help with rotating lines

Use Draw.Arc. This is perfect, as you can decide at exactly what angle you want the line.

It works like this:
code:

Draw.Arc (x, y, height, width, angle1, angle2, color)


where x and y are the centre coordinates, height is the length of the top line (I think...) and width is the length of the bottom line. angle1 is the amount of degrees away from zero the top line is, and angle2 is the amount of degrees away from zero the bottom line is.
Note that 0 is on the right end of the horizontal axis.

To make it look like a needle, you would make angle2 1 degree loarger than angle1. An example:

code:

var angle : int := 90
Draw.FillArc (100, 100, 50, 50, angle, angle+1, black)
Dundertaker




PostPosted: Tue Jun 10, 2008 7:49 pm   Post subject: RE:Help with rotating lines

Thanks, the arc worked, it took me a while, but it worked.
thanks alot
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: