View Single Post
  #2  
Old 12-26-2012, 01:19 PM
Trakan Trakan is offline
It's all about cats!
Trakan's Avatar
Join Date: Sep 2010
Location: France
Posts: 64
Trakan is an unknown quantity at this point
Quote:
Originally Posted by xAndrewx View Post
HTML Code:
function onKeyPressed(keyCode, keyName, scanCode) {
  if (keyName != "e") return;
  if (this.inMotion) return;

  this.inMotion = true;
  player.ani = "gh_gani_roulade";
  for (temp.i = 0; temp.i < 3; temp.i++) {
    if (onwall2(player.x + (vecx(player.dir)*1.5), player.y + (vecy(player.dir)*1.5), 2, 2)) break;

    if (player.dir in {1, 3}) player.x += vecx(player.dir)*1.5;
    else if (player.dir in {0, 2}) player.y += vecy(player.dir)*1.5;
    sleep(0.05);
  }
  this.inMotion = false;
  player.ani = "idle";  
}
Should work in all directions.
Look up VECX and VECY - everything else is straight forward
Thanks! It work fine but it does not look like realist because there are not the sleep(.1); ect... I try to fix that

EDIT: fixed, thanks dude

EDIT2: @xAndrewx: I don't know where i put the freezeplayer xD

Last edited by Trakan; 12-26-2012 at 01:47 PM..
Reply With Quote