Computer Science Canada Making a Program Do 2 Actions at Once... please help |
Author: | UnTiteled [ Mon Jan 11, 2010 8:40 pm ] | ||
Post subject: | Making a Program Do 2 Actions at Once... please help | ||
What is it you are trying to achieve? <Replace all the <> with your answers/code and remove the <>> i am trying to make my fireball move accross the screen while you can still move the character (please dont post any links to tutorials, and i know my program has alot of junk variables and constants ) What is the problem you are having? <Answer Here> onve you press space to shoot the fireball, everything else dissapears and the fireball moves accross the screen once the fireball arives at its destination, everything else is vissible again, until u press space again Describe what you have tried to solve this problem <Answer Here> i have tryed everything my mind can think of Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <Answer Here>
Please specify what version of Turing you are using <Answer Here> i am using 4.1.1 |
Author: | UnTiteled [ Mon Jan 11, 2010 8:48 pm ] |
Post subject: | RE:Making a Program Do 2 Actions at Once... please help |
And if you're just gonna tell me to learn more about turing, juist dont post anything, I have my knolage about turing and what i know doesnt work...Thank you (actually i dont have too much junk VARs) |
Author: | B-Man 31 [ Mon Jan 11, 2010 10:16 pm ] |
Post subject: | RE:Making a Program Do 2 Actions at Once... please help |
you could save a lot of space if you use a for loop for the loading bar. |
Author: | syntax_error [ Mon Jan 11, 2010 10:46 pm ] |
Post subject: | RE:Making a Program Do 2 Actions at Once... please help |
Im not sure exactly what you want to do your code seemed overly repetitive for me to read through but to have to 2 different proc running at once use fork but I suggest you find a way around it forking isnt a great idea. |
Author: | TerranceN [ Tue Jan 12, 2010 1:58 am ] | ||||
Post subject: | Re: Making a Program Do 2 Actions at Once... please help | ||||
You need to only use one loop. Let me explain why this approach is giving you the results you are getting your logic is like this (pseudo code, dont try to compile this)
when the fireball stuff isn't running, all is fine and well, but when fireball_starts your code ONLY updates the fireball until the fireball is not needed anymore, but you want it to update both the main stuff and the fireball. In order to do this you need to only have one loop and surround the fireball update code in an if statement that will only run when the fireball is active, and set the fireball to inactive when appropriate (pseudo code once again)
Finally, a few things you may want to do to help your coding -use the debugger controls, especially trace execution, in order to see the flow of you program -use the indent tool, it also makes it easier to see the flow of your program -theres no need for the loading screen, having to wait for stuff to load is supposed to be a bad thing (and can be annoying for others debugging/reading your code) -you should absolutely learn more about turing, for example, putting a lot of your code into functions would make it much easier to read, and therefore debug Hope this helps |
Author: | UnTiteled [ Tue Jan 12, 2010 7:03 am ] |
Post subject: | RE:Making a Program Do 2 Actions at Once... please help |
thanks guys for this i cant try it right now but jim sure itll work |
Author: | UnTiteled [ Tue Jan 12, 2010 3:09 pm ] |
Post subject: | RE:Making a Program Do 2 Actions at Once... please help |
alright i tryed it now and it almost works perfectly thanks for the help |