Computer Science Canada Delay help |
Author: | Ldomi [ Tue Jan 09, 2007 7:20 pm ] | ||
Post subject: | Delay help | ||
I made a racing game where if you or the computer goes in a puddle of mud, your car slows down. My problem is that when the computer's car goes in the mud, it makes the other car slow even though it is not on the mud. How do i make only the car that goes in the mud slow down and not the other car that avoided the mud. This is the part im having problems with:
|
Author: | Clayton [ Tue Jan 09, 2007 7:47 pm ] |
Post subject: | Re: Delay help |
Instead of using a delay() which slows down the entire program, have a velocity variable, and lower the velocity when you go through the puddle |
Author: | ericfourfour [ Tue Jan 09, 2007 7:53 pm ] | ||
Post subject: | Re: Delay help | ||
Instead of delaying the program, give each player a speed, speed effect, and total speed variable. The speed is the amount of pixels the player should move every frame. The speed effect is an effect on the speed that either increases or decreases it. The total speed is the actual amount of pixels the player moves every frame.
|
Author: | Ldomi [ Thu Jan 11, 2007 9:41 pm ] | ||
Post subject: | Re: Delay help | ||
ericfourfour wrote:
What's the "..."? |
Author: | Ultrahex [ Thu Jan 11, 2007 11:10 pm ] | ||
Post subject: | Re: Delay help | ||
Basically what he is saying is you need to have speeds on your vechiles say you are moving at a rate of 2m/s on road, and 1m/s on dirt then you would set the current velocity to whatever one its on. so you need a set of data for each car saying its speed and you need to move it by that speed.
|
Author: | Clayton [ Thu Jan 11, 2007 11:16 pm ] | ||
Post subject: | Re: Delay help | ||
Ldomi @ Thu Jan 11, 2007 9:41 pm wrote: ericfourfour wrote:
What's the "..."? The ellipses just show you that there is other code in it's place. He just did that to show you the main point instead of hiding it in a mass of variables and statements. |
Author: | Ldomi [ Sat Jan 13, 2007 4:44 pm ] |
Post subject: | Re: Delay help |
ok, thank you very much =) |