Thread: Object Movement
View Single Post
  #1  
Old 03-13-2007, 11:36 PM
Chandler Chandler is offline
Banned
Join Date: Jan 2007
Posts: 656
Chandler will become famous soon enough
Object Movement

HTML Code:
function beginMovement()
  {
  this.getPosition();
  temp.movePosition = {
    (this.currentLocation[1] - this.x), 
    (this.currentLocation[2] - this.y)
  };
  this.dir = getdir(temp.movePosition[0], temp.movePosition[1]);
  this.ani = "walk";
  temp.moveDirs = {
    {1, {1.7, 1}}, {0, {-1.7, 1}}, {2, {1.7, -1.7}}, {3, {-1.7, -1.7}}
  };
  this.chat = "Moving towards" SPC this.currentLocation[0] @"!";
  
  for (temp.currentDirection: temp.moveDirs)
    if (this.dir == temp.currentDirection[0])
      for (temp.newAmount: temp.currentDirection[1])
        temp.moveAmount.add(temp.newAmount);   
  move((temp.movePosition[0] + temp.moveAmount[0]), (temp.movePosition[1] + temp.moveAmount[1]), 1, 8+16);
  }
function getPosition()
  {
  temp.randomLocation = int(random(0, this.warpLocations.size()));
  temp.newLocation = this.warpLocations[temp.randomLocation];
  if (temp.newLocation[0] != this.currentLocation[0])
    this.currentLocation = temp.newLocation;
   else
    this.getPosition();
  }
function onMovementFinished()
  this.ani = "idle";
Well, it is supposed to run through levels. I've tried adding
PHP Code:
  this.canwarp();
  
this.canwarp2(); 
Neither seem to solve this! Any solutions?
Reply With Quote