spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * Character functions and properties

LockViewAligned

(Formerly known as SetCharacterViewEx, which is now obsolete)

Character.LockViewAligned(int view, int loop, Alignment)

Sets the character's view to VIEW, and sets the character's current frame to the first frame in LOOP of VIEW.

The main purpose of this command is that it can align the new frame to the previous one. This is particularly useful if you want to go from the character's normal walking view to a specific animation - since characters have the central point as their 'axis', if you have a wider animation then it can be difficult to stop yourself getting a jumping effect when the animation starts.

Alignment can have one of the following values:

align Description
eAlignLeft Moves the new frame so that the left hand side is at exactly the same X co-ordinate as the old one was.
eAlignCentre Leaves the frames centred in the middle. This is the default and using this is equivalent to just calling LockView.
eAlignRight Moves the new frame so that the right hand side is at exactly the same X co-ordinate as the old one was.

Note that this only aligns the first frame of the animation, so to get the full benefit all your frames in the animation loop should be the same width. All following frames will be shifted by the same amount, until UnlockView is called.

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 the program on regions, screen changes, etc). When you are done with the animation, call UnlockView to allow the program to take control back.

Example:

cEgo.LockViewAligned(12, 1, eAlignLeft);
cEgo.Animate(1, 5, eOnce, eBlock, eForwards);
cEgo.UnlockView();
will change the character's EGO view to view 12, perform an animation using loop 1, wait until the animation finishes and then return the character to his normal view.

See Also: Character.LockView, Character.LockViewOffset, Character.UnlockView


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.