PDA

View Full Version : Walking



cholin
July 11th, 2005, 11:29 PM
I dont like to ask questions that I know can be easily solved, but we all have our moments of stupidity. In my RPG engine I attach a movie clip to a variable, char. In a function I set char = _root.tiles.char; which works fine, no problems there. I can adjust char._x, that kinda crap, but my calls to gotoAndPlay or gotoAndStop wont work. How would I fix that?


function detectMovements()
{
char = _root.tiles.char;
_root.checkCharacter(char);
if ((Key.isDown(Key.UP) || Key.isDown(87)) && char.canGoUp == true) {
char.gotoAndPlay("walkingup"); // WONT WORK!!!!!!!
newY = char._y - int(_root.speed);
moveCharacter(char, char._x, newY);
} else if ((Key.isDown(Key.LEFT) || Key.isDown(65)) && char.canGoLeft == true) {
char.gotoAndPlay("walkingleft"); // WONT WORK!!!!!!!
newX = char._x - int(_root.speed);
moveCharacter(char, newX, char._y);
} else if ((Key.isDown(Key.DOWN) || Key.isDown(83)) && char.canGoDown == true) {
char.gotoAndPlay("walkingdown"); // WONT WORK!!!!!!!
newY = char._y + int(_root.speed);
moveCharacter(char, char._x, newY);
} else if ((Key.isDown(Key.RIGHT) || Key.isDown(68)) && char.canGoRight == true) {
char.gotoAndPlay("walkingright"); // WONT WORK!!!!!!!
newX = char._x + int(_root.speed);
moveCharacter(char, newX, char._y);
} else {
char.stop();
}
}

SeiferTim
July 12th, 2005, 10:55 AM
My guess is that you're somehow not pointing to the right place.... I don't know.... I don't really like to use named frames - though that's probably just a matter of prefference. Could it be that you mistyped the names of your frames? Could there be a case-sensitivity problem? If you post your FLA, I'm sure someone could find the answer.

cholin
July 12th, 2005, 12:26 PM
I cant quite post my FLA but I can assure you that I tried without naming frames. I called gotoAndPlay(6) and it still wont do anything... like you expect that maybe it will go to that frame and get stuck, but it doesnt go to that frame at all. I figured maybe I named it wrong and I cant call char.goto..... but I can manipulate char anyways so I know it's the right variable...

cholin
July 12th, 2005, 04:25 PM
I tried using a tellTarget and it works but only with certain frames, so I figured that the problem is that is wont play certain frames of the animation, so Im taking off the labels and trying again...