Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-14-2009, 02:59 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Custom Movement: Help Needed!

Okay so what I have here lets me move fine altho it does not let me move flush against the wall.. and if walking between 2 wall tiles.. example: wall, non, non, wall u have to be perfectly in between the walls to move. Also only lets me move at speeds close to (16/16) i think.

Anyone have any suggestions on making movements twards a wall flush? And is there any way to output the collision points of a onwall2?

PHP Code:
//#CLIENTSIDE
function onCreated()
{
  
this.enabled true;
  
setTimer(0.05);
  if ( 
this.enabled == true )
  {
    
disabledefmovement;
  } else {
      
enabledefmovement;
      }
}

function 
onTimeOut()
{
  
this.speed = (8/16);

  for ( 
i=04i++ )
  {
    if ( 
keydown(i) )
    {

  
temp.tw = ( abs(vecx)) == 16 32 ) / 16;
  
temp.th = ( abs(vecy)) == 16 32 ) / 16;
  
temp.aa = ( abs(vecy)) == .5 );
  
temp.tx player.vecx) * temp.aa;
  
temp.ty player.vecy) * temp.aa;
    
      if ( 
player.ani != "walk" && player.ani != "swim") {
        
setAni("walk"null);
      }

      if ( 
this.enabled == true )
      {
        
player.dir i;
        
temp.nx player.vecx(i)*this.speed;
        
temp.ny player.vecy(i)*this.speed;
        if ( !
onwall2temp.txtemp.tytemp.twtemp.th ) ) {
          
player.temp.nx;
          
player.temp.ny;
        }
      }
    } else {
        if ( !
keydown(0) && !keydown(1) && !keydown(2) && !keydown(3) ) {
          if ( !
onwaterplayer.xplayer.) ) {
            
setAni("idle"null);
          }
        }
      }
  }

  if ( 
onwaterplayer.xplayer.) ) {
    if ( 
player.ani != "swim" ) {
      
setAni("swim"null);
    }
  }

  
  
setTimer0.05 );
  
  
// debug only
  
showpoly(200,{temp.tx,temp.ty,temp.tx+temp.tw,temp.ty,temp.tx+temp.tw,temp.ty+temp.th,temp.tx,temp.ty+temp.th});
  
changeimgcolors(200,1,0,0,.25); 
  

Any help or suggestions appreciated.

PS: This is a rough draft. I know its sloppy but its readable non-the-less.
Reply With Quote
 


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:02 PM.


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