Multiple walk-cycles. Can't keep player walkspeed the same for each.. SOLVED

Started by markbilly, Sun 23/08/2009 13:17:22

Previous topic - Next topic

markbilly

I have multiple walk-cycles for my main character. i.e. when they are carrying something, the walk-cycle view changes. I have set the walk-speed and animation delay in the character's settings, however when the view is changed from, say View2 to View9 because the character has picked something up, he will then zip across the screen at lightning speed, as opposed to the speed he had just been walking in View2.

Confused. Help.

There is a part-solution in setting the animation delay and walk-speed manually when the view is changed in the script. But, of course, if I want to change the view in a "repeatingly executing" script, this won't work.

Thanks.

EDIT: I've worked out the problem, just not a solution. It's to do with repeatedly execute.

I have this script in repeatedly execute. But clearly if the script is repeatedly doing ChangeView on every loop, then the animation delay/walk-speed is messed up.

Code: ags
  if (cEgo.ActiveInventory==ibug) {
    withbug=1;
    cEgo.ChangeView(10);
  }  
  else if (cEgo.ActiveInventory!=ibug) {
    withbug=0;
    cEgo.ChangeView(2);
  }


Basically, I need another way of doing this without using repeatedly execute.

Thanks.
 

Mazoliin

If you only need to do this once you can use Game.DoOnceOnly
Code: ags

if (cEgo.ActiveInventory==ibug){
  if (Game.DoOnceOnly("HaveBug")) cEgo.ChangeView(10);
}  
else if (cEgo.ActiveInventory!=ibug){
  if (Game.DoOnceOnly("NoBug")) cEgo.ChangeView(2);
}


But if you need to be able to use it more then once you just need a variable (I asumed withbug is a int):
Code: ags

if ((cEgo.ActiveInventory==ibug)&&(!withbug)){
  withbug= 1;
  cEgo.ChangeView(10);
}  
else if ((cEgo.ActiveInventory!=ibug)&&(withbug)) {
  withbug= 0;
  cEgo.ChangeView(2);
}

markbilly

Perfect.

It's this kind of simple scripting I need to get sorted in my head. I'm fine with adding inventory items and simple if statements... I've just started doing a quick project with tonnes of more complex (but still fairly straightforward) scripting to practice all this sort of stuff...
 

SMF spam blocked by CleanTalk