View Single Post
  #1  
Old 10-18-2006, 01:31 AM
excaliber7388 excaliber7388 is offline
Banned
excaliber7388's Avatar
Join Date: Jul 2005
Location: US
Posts: 5,229
excaliber7388 can only hope to improve
Send a message via AIM to excaliber7388
Legend movement preview

A preview of the script I plan to use for the movement. There will be variations for speed, and the distance you travel after you let go of the button (for flying and other vehicles) but this is a general idea of what it will be like. It's pretty smooth, but I'm working on it even better. Also, this is in GS1 just so you can test it off line. What do you think?
PHP Code:
if(created)
{
  
freezeplayer .05;
  
timeout .05;
}
if(
timeout)
{
  if(
this.count==1)
  {
    
this.cx=mousex-.5;
    
this.cy=mousey-.5;
    
this.count=0;
  }
  
this.count++;
  
showimg 1000,dr-crosshairs.png,this.cx,this.cy;
  
freezeplayer .05;
  if(
keydown(0))
  {
    
playerx+=.75*sin(this.ang*(3.14/180));
    
playery-=.75*cos(this.ang*(3.14/180));
  }
  if(
keydown(2))
  {
    
playerx-=.75*sin(this.ang*(3.14/180));
    
playery+=.75*cos(this.ang*(3.14/180));
  }
  if(
keydown(1))
  {
    if(
abs(playery-mousey)>abs(playerx-mousex))
    {
      
playerx-=.75*cos(this.ang*(3.14/180));
    }
    else
    {
      
playerx+=.75*cos(this.ang*(3.14/180));
    }
    if(
abs(playery-mousey)>abs(playerx-mousex))
    {
      
playery+=.75*sin(this.ang*(3.14/180));
    }
    else
    {
      
playery-=.75*sin(this.ang*(3.14/180));
    }
  }
  if(
keydown(3))
  {
    if(
abs(playery-mousey)>abs(playerx-mousex))
    {
      
playerx+=.75*cos(this.ang*(3.14/180));
    }
    else
    {
      
playerx-=.75*cos(this.ang*(3.14/180));
    }
    if(
abs(playery-mousey)>abs(playerx-mousex))
    {
      
playery-=.75*sin(this.ang*(3.14/180));
    }
    else
    {
      
playery+=.75*sin(this.ang*(3.14/180));
    }
  }
  
timeout .05;

Reply With Quote