Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.