ForceUp and bouncing.

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

ForceUp and bouncing.

Post by metal_head » Sun Nov 29, 2009 4:56 pm

So I started scripting a boat player, as I'm planning to have a level where you drive a boat along a canal, chasing bad guys. So far, so good, but I got a problem:
I wanted to make it more reallistic by making the boat bounce on the waves when moving with high speed, but there is a bug:
http://www.mediafire.com/?nmlgtwymvmy The boat some sort of shakes and twitches when doing that.
I'm using the ForceUp command to make the boat bounce and this is the part of the script, which does all this:

Code: Select all

Wave[ ()
{
if ((SPEED >= 50) and (SPEED <= 100))
{
AMOUNTMIN = 5;
AMOUNTMAX = 10;
}
if ((SPEED >= 100) and (SPEED <= 150))
{
AMOUNTMIN = 15;
AMOUNTMAX = 35;
}
if ((SPEED >= 150) and (SPEED <= 200))
{
AMOUNTMIN = 25;
AMOUNTMAX = 45;
}

if (SPEED < 50)
{
AMOUNTMIN = 0;
AMOUNTMAX = 0;
}
TIMEAMOUNT = random(0.2, 0.8);
if(self.IsFalling and (FORCETIMER <= self.time))
{
FORCETIMER = self.time + TIMEAMOUNT;
}

if (FORCETIMER < self.time)
{
FORCEAMOUNT = random(AMOUNTMIN, AMOUNTMAX);
ForceUp(FORCEAMOUNT);
JUSTLANDED = true;
}
} ]

Post Reply