Ok, this seems like a stupid, easy question but I have searched everywhere and can't seem to find an answer.
My goal: to exceed the 19-frame limit on walking animations while still having eight different walk directions.
Basically, AGS is set up to automatically deal with with walking animations: in a View, the first loop (loop 0) is walk down, the second is walk left, etc. Each loop accepts 19 frames of animation, no more. In order to have a very smooth animation, however, I want to use more like 30 frames for each direction the character can walk (Up, Down, Left, Right, and the four diagonals). How can I get around this?
I've already checked that box that says, "run the loop after this one to make one long animation" and while it works fine in the preview, when I actually run the game AGS plays only loop 0 over and over again and completely ignores the next loop. Besides, it seems like checking that box means that Loop 1 (the second loop, usually reserved for Walk Left), is used for Walk Down, which therefore limits the number of directions the guy can walk (8 becomes 4).
Any ideas? I can't find any script command like "IsCharacterWalkingLeft" or anything like that, which I could use to tell which way the player is walking and therefore let me run the appropriate animation.
You could set up the standing frames in the Character's normal view and then set up the walking frames for each direction in a different view. Then you could do this:
bool viewLocked = false;
function repeatedly_execute_always() {
if ((player.Moving) && (!viewLocked)) { // the player is moving and the view has not been locked yet
if (player.Loop == 0) player.LockView(VPLAYERDOWN);
else if (player.Loop == 1) player.LockView(VPLAYERLEFT);
else if (player.Loop == 2) player.LockView(VPLAYERRIGHT);
else if (player.Loop == 3) player.LockView(VPLAYERUP);
player.Animate(0, player.AnimationSpeed, eRepeat, eNoBlock);
viewLocked = true;
}
else if ((!player.Moving) && (viewLocked)) { // the view is locked, but player stopped moving
player.UnlockView();
viewLocked = false;
}
}
This is untested and may take some work to get the starting/stopping to look exactly right, but hopefully this can start you off in the right direction.
@Ashen's post down there (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=33260.msg431079#msg431079):
Heh. I completely forgot AGS 3.0 removed that limit, but yes, if you're not too far into development, I would highly recommend a port to AGS 3.0 (for several reasons). ;)
Also I've changed 'repeatedly_execute' to 'repeatedly_execute_always' because rep_ex won't run during a blocking animation (such as walking (the 'Walk' function itself is blocking (normally))). AFAIK rep_ex_always will still be run though.
Thanks, that makes a lot of sense! I will give that a try...
Or, if you're not very far into your game, update to 3.0 which has no limit on Frames per Loop.