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

Username:   Password: 
 RegisterRegister   
 Process and procedure troubles
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
antiLogic




PostPosted: Sat Jun 13, 2009 2:29 am   Post subject: Process and procedure troubles

What is it you are trying to achieve?
Ok suppose I have 3 planes sprites moving around autonomously. Each of these planes is 1 process. I want to make my program so that when I click 1 plane, I am given keyboard control to said plane. Also, I'd like to make it so that when I have 1 plane clicked and I click another, the original clicked plane would be moving in a straight path again automatically and the newly clicked plane would be under keyboard control.


What is the problem you are having?
I am not sure how I should attack this problem. I thought about sending the coords of one plane to a procedure from the autonomous plane flight process and having the procedure take over but how would I send the controls back to the computer when I click another plane?

Describe what you have tried to solve this problem
I have coded a process which controls a plane sprite to fly a straight line automatically. When the plane sprite is clicked, the coordinates of the sprite is sent into a procedure which allows keyboard control.


Please specify what version of Turing you are using
<Answer Here>
4.1.1

Thanks for all the help everybody, this community has been very helpful.
Sponsor
Sponsor
Sponsor
sponsor
tjmoore1993




PostPosted: Sat Jun 13, 2009 8:36 am   Post subject: RE:Process and procedure troubles

I'd like to address first of all that processes do take system resources which cause a lot of lag if not disposed of correctly or if you are using too many.

You can set them all up in a main loop so that they all will fly without lag? Anyways, to approach what you asked you can do statements...

I recommend approaching this step by creating a procedure that you will be assigning a value. This value will be your PlaneID it will be used to figure out which Plane you want to control.

Fly (2) % This would be Plane 2

You would also have a loop that will check for when a plane is clicked, when it is clicked that is when you will select the Plane.

If this doesn't make sense post.
antiLogic




PostPosted: Sat Jun 13, 2009 10:09 am   Post subject: RE:Process and procedure troubles

How do I dispose of an active process? Also, I think I understand what you are getting at, thanks.
tjmoore1993




PostPosted: Sat Jun 13, 2009 4:42 pm   Post subject: Re: RE:Process and procedure troubles

antiLogic @ Sat Jun 13, 2009 10:09 am wrote:
How do I dispose of an active process? Also, I think I understand what you are getting at, thanks.


When you are not using processes they just slow down your resources. The only thing that should be forked is your media but even then you can still put it in a procedure.
Kharybdis




PostPosted: Sat Jun 13, 2009 5:27 pm   Post subject: RE:Process and procedure troubles

Processes are generally random, and thus give you less control over your program. You only really use them to play music, and that's all. For everything else, there's procedures.
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: