Ok, this is possibly so noob question I thought that I should post it in the Beginners forum:
How do I animate a character when he is moving, ignoring the walkable areas. I've been fighting with the script for a while now but it just won't work.Ã, ???
MoveCharacterDirect (CHARID, int x, int y)
Moves the character CHARID from its current location to (X,Y) directly, ignoring walkable areas on the screen. This is identical to the "Move to, ignore walls" animation command.
Example:
MoveCharacterDirect(EGO,222,145);
will make the character EGO walk to 222,145 ignoring walkable areas
See Also: MoveCharacter, MoveCharacterPath, MoveCharacterStraight
MoveCharacterStraight
MoveCharacterStraight (CHARID, int x, int y)
Moves the character CHARID from its current location to (X,Y) in a straight line as far as is possible before hitting a non-walkable area. This is useful for use with the arrow keys for character movement, since it guarantees that the character will move in a straight line in the direction specified. This function is non-blocking.
Example:
MoveCharacterStraight(EGO,166,78);
will move the character EGO in a straight line towards co ordinates 166,78 until he hits a non walkable area.
See Also: MoveCharacter, MoveCharacterDirect
I think he knows how to move characters and that the problem is moving the character while he is performing an animation.
I've tested it and it seems the walking loops of the locked animation view are used when moving the character with the MoveCharacter* commands.
All I can think of at the moment is modifying the character.x variable directly with something like this:
SetCharacterView(THECHAR, 10); // lock view 10 for animation
AnimateCharacter(THECHAR, 3, 0, 1); // start repeating animation using view loop 3
int i = 0; // declare loop counter
while (i < 30) { // repeat the following 30 times:
character[NAME].x -= 1; // move character 1 pixel to the left
Wait(1); // wait 1 game loop
i++; // increase loop counter
}
ReleaseCharacterView(THECHAR); // stop animation and restore normal view