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

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




PostPosted: Mon Jan 08, 2007 8:01 pm   Post subject: Rotation Help

here dis is the rite place to post this i guess so here it goes

guyz could any of you try to explain to me how to move the plane in the direction its facing after the rotation is done. freakman said somthing about i need to learn trig ... if dat rings a bell maybe some explain this to me

thnkx



Game.rar
 Description:
sry thers no comenting buh i don think you guyz will need it anywayz

Download
 Filename:  Game.rar
 Filesize:  15.04 KB
 Downloaded:  83 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: Mon Jan 08, 2007 8:30 pm   Post subject: Re: Rotation Help

You need to know trigonometry for this one. Either that or only let the aeroplane rotate 90 degrees at a time so you only have to deal with up, left, down, and right.
Masta_911




PostPosted: Mon Jan 08, 2007 8:47 pm   Post subject: Re: Rotation Help

thanks buh is there a way to convert a integer variable to a real variable.... like intstr converts integer to a string
Clayton




PostPosted: Mon Jan 08, 2007 8:57 pm   Post subject: Re: Rotation Help

why would you need to change an integer variable to a real variable? The only time I would see where you need to switch between the two is when you are going the other way: fom real to integer. If you really wanted to change an integer to a real, make a function that makes the integer a string, then changes the string to a real.
Masta_911




PostPosted: Mon Jan 08, 2007 9:07 pm   Post subject: RE:Rotation Help

no i want to make somthing move at a speed of 0.0694 and thats not possible if the variable is integer so i want to convert it. buh i did find a command word to do it. its "intreal" does any one know how to use this command because i cant figure it out using Turing help...
if u do kindly help
Clayton




PostPosted: Mon Jan 08, 2007 9:10 pm   Post subject: Re: Rotation Help

I'm not entirely sure about intreal(), but if it's like the rest of the family (strint, intstr etc) it should simply take in an integer parameter and change it to real. With your speed though, you will have to round your x and y co-ordinates back to integers to be able to move the picture anyways, so just make your x and y real and round() them when you draw your picture.
Masta_911




PostPosted: Mon Jan 08, 2007 9:46 pm   Post subject: Re: Rotation Help

i dont know how this involves trig i noe sum trig my self and my sister is very good at math and she agreed to help me buh unfortunately she doesnt know a thing about turing so if sum1 can explain how to move the plane in the direction its facing with pressing the up key dat would be great

and i kinda did find a way to make it work

if the plane is in 5 degrees i could add 5 to the Y and subtract 0.0694 from the X
i am doing this because 360/5 = 72
5/72 = 0.0694.... so it moves in the same direction its facing buh i cant subtract 0.0694 from the X because its a integer so if sum1 could figure out how to do that it would be fine to or u can jus teach me how to do it the trig way Very Happy

thanks

this is the code to make it clear........ sry freakman and evr1 else i cant find the code button on my Post a reply screen for sum kind of reason so i am going to just paste the code part which would help it make it clear for you guys to know what i want.

var x, y : int := 100
var yo : int := Pic.FileNew ("space.jpg")
var yo2 : int
var z : int := 0
var chars : array char of boolean
var x1 : int := 60
var y1 : int := 60


loop
yo2 := Pic.Rotate (yo, z, x1, y1)
Input.KeyDown (chars)

if chars (KEY_UP_ARROW) then

if z = 0 then
y := y + 5
end if

if z = 5 then
y := y + 360
x := x + 1 ----- % i want this to be 0.0694 so its in the perfect direction i noe its stupid buh i am ready to do this
end if % for every degree
end if

thanks and plz helppppp
and if there is a certain way to put the code let me know cuz i cant figure it out its not by the top where URL and the rest of the stuff are



PLZZZ HELPPP
Clayton




PostPosted: Mon Jan 08, 2007 10:23 pm   Post subject: Re: Rotation Help

You don't need to use the code button, you can just manually type in the [code] and [ /code] tags yourself around the code.

For the trig part, there is a tutorial on getting something following the mouse, which uses trig, and can be found in [General Programming], just search for it, or search for something incorporating trig into your games.

Also, please don't beg for help at the end of your posts, we know you're here for help, you don't need to keep saying it.
Sponsor
Sponsor
Sponsor
sponsor
ericfourfour




PostPosted: Mon Jan 08, 2007 11:04 pm   Post subject: Re: Rotation Help

If you want to convert an integer to a real number you start by using your brain.
Turing:
var num : int := 5
var num2 : real := num


If you are weird and need a function to do it:
Turing:
fcn intToReal (num : int) : real
    result num
end intToReal


If you are still completely clueless this is why what I just said was completely pointless:
Turing Help wrote:
The intreal function is used to convert an integer to a real number. This function is rarely used, because in Turing, an integer value can be used where ever a real value is required. When the integer value is used where a real value is required, the intreal function is implicitly called to do the conversion from int to real.
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  [ 9 Posts ]
Jump to:   


Style:  
Search: