Ball>draw Actor>
- Code: Select all
directional_velocity *=.98; //make ball slow down
if(directional_velocity<.01){ //make ball stop if nearly stopped (prevents shaking)
directional_velocity=0;
}
You can also then create a float (real) array, and set the slowdown for terrain types;
for instance
- Code: Select all
tslowdown[0]=.998; //speed to slow down while in air
tslowdown[1]=.99; //speed to slow down while on grass
tslowdown[2]=.90; //speed to slow down while on sand
then have the ball start with a terrain of 0; and change that to 1 on collision with ground, or 2 on collision with sand trap.
then
- Code: Select all
directional_velocity*=tslowdown[terrain];
You could just nix the slowdown in the air, that may be best if it doesn't slow down till it hits something.
Then on your collision, try adjusting the power of the ball. There are 4 variables in physical response;
The 3rd one is 'final velocity multiplier' for event actor. You can adjust this till you get a response you like.