(Formerly known as SetCharacterViewOffset, which is now obsolete)
Character.LockViewOffset(int view, int xOffset, int yOffset)
Sets the character's view to VIEW, in the same way as LockView does. However,
it also adds a specified offset to all the character's frames until UnlockView
is called.
The XOFFSET and YOFFSET parameters specify in actual game resolution units how much
to move the character's sprite. Positive values for X move right, for Y move down; negative
values do the opposite.
This command is designed to allow you to cope with those niggly situations where animations
don't quite line up with the standing frame, assuming all the frames of the animation are
the same size. Note that LockViewAligned is easier to use if your frames will align at
the left or right hand side.
NOTE: You should only use this command for minor adjustments, since the offsets do not
affect the clickable area of the character, what walkable area he is in, and so forth. You
should limit the use of this command to in-game cutscenes where the player has no control.
NOTE: This is the only command in AGS which uses actual game-resolution co-ordinates.
Therefore, specifying an x offset of 1 will actually move 1 pixel in a 640x400 game, and will
not be multiplied up to 2 (they will be automatically adjusted though if the player chooses
to play the game at another resolution).
NOTE: This function locks the character's view to the specified view, so
that it can only be changed by other script commands (ie. it won't
automatically be changed by AGS on walkable areas, screen changes, etc). When
you are done with the animation, call UnlockView to allow AGS to take control back.
Example:
cEgo.LockViewOffset(12, 1, -1);
cEgo.Animate(1, 5, eOnce, eBlock, eForwards);
cEgo.UnlockView();
will change EGO's view to view 12 and animate using loop 1, meanwhile all frames will be
shifted 1 pixel right and 1 pixel up.
See Also: Character.LockView,
Character.LockViewAligned,
Character.UnlockView
|