Computer Science Canada Killing a process? |
Author: | Naga [ Sat Jan 13, 2007 5:58 pm ] |
Post subject: | Killing a process? |
Is there any way to stop a process from running? I'm doing this game where there's a counter. The counter counts down from 30. However, I want a way to stop it. The game, which is what it's for, has the user move away from an enemy, and you have 30 seconds to do this. If you get hit, the counter has to stop and it loads a small questionnaire, which is like punishment for being caught. I have the counter in a separate process. Is there a way to kill that process once the player gets hit? |
Author: | Prince Pwn [ Sat Jan 13, 2007 6:54 pm ] | ||
Post subject: | Re: Killing a process? | ||
If you press F10 and look up condition it teaches you how to "make a process sleep":
|
Author: | neufelni [ Sat Jan 13, 2007 6:54 pm ] | ||
Post subject: | RE:Killing a process? | ||
First of all, you shouldn't be using a process for your counter. You shouldn't be using processes at all, since they are not very good in Turing. Just put the counter in your main loop or in the procedure where your enemy attack is. And it would probably be a good idea to have a boolean variable to tell if you've been hit. Then just add an if statement. You would then have something like this:
And then when the user is done answering the question, you set the variable hit back to true and reset your count variable to 30. |