Thread: Onwaal
View Single Post
  #7  
Old 05-25-2007, 01:44 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I'll just post my code... JKWhoSaysNi, thanks, but that won't work with full angles (I think?)

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.speed 2;
  
this.car false;
  
setTimer0.05 );
}
function 
getMoveX()
{
  return 
player.+ ( this.mspeed sinthis.ang ) );
}
function 
getMoveY()
{
  return 
player.+ ( this.mspeed costhis.ang ) );
}
function 
getMoveDX()
{
  return 
player.+ ( sinthis.ang ) );
}
function 
getMoveDY()
{
  return 
player.+ ( costhis.ang ) );
}
function 
willCrash()
{
  
temp.movex getMoveX();
  
temp.movey getMoveY();
  
  if ( 
onwalltemp.movextemp.movey ) )
  {
    return 
true;
  }
  if ( 
onwalltemp.movex 1temp.movey ) )
  {
    return 
true;
  }
  if ( 
onwalltemp.movex 1temp.movey ) )
  {
    return 
true;
  }
  if ( 
onwalltemp.movextemp.movey ) )
  {
    return 
true;
  }
  if ( 
onwalltemp.movextemp.movey ) )
  {
    return 
true;
  }
  
  if ( 
onwalltemp.movex 3temp.movey ) )
  {
    return 
true;
  }
  if ( 
onwalltemp.movex 2temp.movey ) )
  {
    return 
true;
  }
  if ( 
onwalltemp.movextemp.movey ) )
  {
    return 
true;
  }
  if ( 
onwalltemp.movextemp.movey ) )
  {
    return 
true;
  }
}
function 
doHonk()
{
  
player.attr[8] = "eb_sound-honk.gani";
  
scheduleevent.2"ClearHorn""" );
}
function 
newCheck()
{
  
temp.movex getMoveX();
  
temp.movey getMoveY();
  
s1 = ( onwall2temp.movextemp.movey abs(vecx(this.dir)),1,1)) ? 10;
  
s2 = ( onwall2temp.moveyy+vecy(this.dir)+vecy(this.dir)+abs(vecx(this.dir)*2),1,1)) ? 10;
}
function 
onClearHorn()
{
  
player.attr[8] = "";
}
function 
setDir()
{
  
temp.movex getMoveDX();
  
temp.movey getMoveDY();
  
player.dir getdirtemp.movex player.xtemp.movey player.);
}
function 
checkCar()
{
  
player.attr[7] = this.ang;
  
client.car_angle this.ang;
  
setAni"sit"NULL );
  
disabledefmovement();
  
temp.movex getMoveX();
  
temp.movey getMoveY();
  
  if ( 
keydown) )
  {
    
this.ang += .1;
    
setDir();
  }
  if ( 
keydown) )
  {
    
this.ang -= .1;
    
setDir();
  }
  if ( 
keydown232true ) )
  {
    
doHonk();
  }
  if ( 
keydown) )
  {
    if ( 
this.mspeed > -)
    {
      
this.mspeed -= .2;
    }
  }

  if ( 
keydown) )
  {
    if ( 
this.mspeed this.speed )
    {
      
this.mspeed += .05;
    }
  }
  else
  {
    if ( 
this.mspeed )
    {
      
this.mspeed -= .1;
      if ( 
this.mspeed )
      {
        
this.mspeed 0;
      }
    }
    if ( 
this.mspeed )
    {
      
this.mspeed += .1;
      if ( 
this.mspeed )
      {
        
this.mspeed 0;
      }
    }
  }
  
temp.movex getMoveX();
  
temp.movey getMoveY();
  if ( 
willCrash() == false )
  {
    
player.temp.movex;
    
player.temp.movey;
  }
  else
  {
    
this.mspeed = - .5;
  }
  
//player.chat = "Speed:" SPC this.mspeed;
  //player.chat = format( "Angle: %s Move X: %s Move Y: %s", this.ang, temp.movex, temp.movey );
}
function 
onTimeOut()
{
  if ( 
this.car == true )
  {
    
checkCar();
    
player.attr[6] = "eb_car.gani";
  }
  else
  {
    
player.attr[6] = "";
    
enabledefmovement();
  }
  
setTimer0.05 );
}
function 
onPlayerChats()
{
  if ( 
player.chat == "/car on" )
  {
    
this.car true;
  }
  if ( 
player.chat == "/car off" )
  {
    
this.car false;
  }

That's not what the car will be like in the end, I just need the basic moving, turning, wall checking.
__________________
Reply With Quote