Computer Science Canada Running two procedures at once |
Author: | msimard8 [ Mon May 02, 2005 12:55 pm ] |
Post subject: | Running two procedures at once |
Is it possible to run two procedures at once. For example (on Super Mario Games you have the turtles and the mushrooms both moving different directions. I need something where there is two seperate procudres executing at once. A for loop wont work for me Thanks |
Author: | jamonathin [ Mon May 02, 2005 1:33 pm ] | ||||
Post subject: | |||||
You can do something like this:
Or do you mean two loops? then you would have to fork, but forking isn't always a great idea. There's another way to delay, without using more than one delay, where that one delay is normally just the game's delay. What you can do is assign a variable to whatever it is you want, and use it as a counter. Once that counter hits a certain spot, then you can do whatever it is you want to do. Here is a sample of what I'm talking about. The pink ball moves twice as fast as the other ball, but the ball only moves when the counter assigned to it reaches a certain value.
|