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

Username:   Password: 
 RegisterRegister   
 Procedures?!?!?!?!
Index -> Programming, Turing -> Turing Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Kharybdis




PostPosted: Wed Nov 04, 2009 3:06 pm   Post subject: RE:Procedures?!?!?!?!

You can do it with Turing by using Forks but that's just horrible and leads to the problems described above.
Sponsor
Sponsor
Sponsor
sponsor
S_Grimm




PostPosted: Wed Nov 04, 2009 4:33 pm   Post subject: Re: RE:Procedures?!?!?!?!

Kharybdis @ Wed Nov 04, 2009 3:06 pm wrote:
You can do it with Turing by using Forks but that's just horrible and leads to the problems described above.


forks do not allow simultaneous running of two different procedures, which is what he wants.


My advice has already been stated by others, but ill write it here anyway:

code:

loop

movement of player

movement of enemy

attack of player

attack of enemy

draw

endloop %only loop in your program


everything that happens BEFORE the draw command will seem to be simultaneously executed on the screen. so for all intents and purposes, it will happen simultaneously. besides, with a high FPS, you will never notice the difference in the time it takes the computer to process the commands.
Chaoskiller




PostPosted: Fri Nov 06, 2009 4:05 pm   Post subject: RE:Procedures?!?!?!?!

hmm ill try what u wee doing although what i was trying to get at is. I want an enemy to patrol in the background off to the side while the player is inputting attacks and movements. When i do it the enemy does its move and then once its finished i am able to input something.
Tony




PostPosted: Fri Nov 06, 2009 4:13 pm   Post subject: RE:Procedures?!?!?!?!

If you are asking about non-blocking IO, then use Input.KeyDown
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Chaoskiller




PostPosted: Fri Nov 06, 2009 5:28 pm   Post subject: RE:Procedures?!?!?!?!

I already am using Input.Keydown for the player to move the sprite around and attack with him. But i still dont know how to make an enemy move at the same time as the player inputting something
Tony




PostPosted: Fri Nov 06, 2009 5:43 pm   Post subject: RE:Procedures?!?!?!?!

But if you are using Input.KeyDown, I don't understand how that is a problem that you are still having. I think it's time for you to post some new code.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Chaoskiller




PostPosted: Fri Nov 06, 2009 6:01 pm   Post subject: RE:Procedures?!?!?!?!

Hmm ok well just letting you know my knowledge of this program is limited because im only half way through a semester in computer science. Although i am very far ahead of my class because of these tutorials on here. ok well i think its because i have my Input.KeyDown in a loop. After the Input.KeyDown commands it does a procedure which animates a sprite. I think the problem is it waits for the procedure to be done before continueing with the loop therefore not letting me to input something while the procedure is running
Tony




PostPosted: Fri Nov 06, 2009 6:09 pm   Post subject: RE:Procedures?!?!?!?!

You've starting to get the right idea. If you have loops inside of your procedures, it becomes Blocking, which makes everything else stop and wait.

To fix the problem, you'd have to remove that loop.

You already have one "main loop", as shown in all suggested code samples above. You could use that in place of adding more loops. For example, instead of having a procedure with a loop that runs for 100 steps, you rewrite the procedure to perform just 1 step, and then call that procedure for the next 100 steps of the main loop.

It might take some thought to figure this setup out.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Chaoskiller




PostPosted: Fri Nov 06, 2009 6:11 pm   Post subject: RE:Procedures?!?!?!?!

ooh ok hmm is there any way i can send you only you my script because its a lot to put on here. Also i need advice on how to easily manage my time and how much i write because half my program is just getting the frames of the picture then turning it into a sprite
Tony




PostPosted: Fri Nov 06, 2009 6:25 pm   Post subject: RE:Procedures?!?!?!?!

I have a lot of personal work to do, but a lot of other people might be able to give you advice.

You can either post just a specific block of code that demonstrates what you are trying to accomplish, or if you need to include everything, you could upload a file.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Chaoskiller




PostPosted: Fri Nov 06, 2009 6:27 pm   Post subject: Re: Procedures?!?!?!?!

ok ill upload a file for anyone that wants to see Smile


RPG.T
 Description:
My RPG u wont be able to play because you dont have the pics

Download
 Filename:  RPG.T
 Filesize:  13.67 KB
 Downloaded:  127 Time(s)

B-Man 31




PostPosted: Sat Nov 07, 2009 11:20 am   Post subject: Re: Procedures?!?!?!?!

Chaoskiller @ Fri Nov 06, 2009 6:27 pm wrote:
ok ill upload a file for anyone that wants to see Smile


Why didn't you include the pictures, if you uploaded a .zip or .rar file with all the pictures and code included, we may be able to help you because we can see the exact problem is.
andrew.




PostPosted: Wed Nov 25, 2009 8:54 pm   Post subject: Re: RE:Procedures?!?!?!?!

Euphoracle @ Wed Nov 04, 2009 8:55 am wrote:
it is a complete and utter nightmare to find and fix the bug.
Pretty sure that's impossible to do in Turing anyways (with processes at least) because it's unpredictable in nature and there isn't anything you can do about it.
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 2 of 2  [ 28 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: