SSH Productions: Module documentation for DistortChar.zip

Module: DistortChar 1.0, by SSH

Distort/Scale characters and views

Download DistortChar as a zip file

Author

Andrew MacCormack (SSH)

Please use the messaging function on the AGS forums to contact

me about problems with this module

Abstract

Distort (i.e. Shrink, enlarge, tint, rotate, flip) every frame

of a character or view. May be useful if they are a different size

to other characters or backgrounds but ManualScaling is not possible

or difficult because of walkable area scaling interfering.

Dependencies

AGS 3.1.2 or later, but may work with earlier versions

Functions

Character.DistortScale(float scale, optional bool portrait)

Scales all the frames of the character by the factor given. If portrait is

specified then skips scaling of the Speech, Thinking and Blinking views for

the character: default is to scale all views.

Character.DistortMakeHeight(int height, optional bool portrait)

Make the character's frames all be *height* pixels high, scaling the width to

preserve the sprite's aspect ratio.

Character.DistortMake(int width, int height, optional bool portrait)

Force all frames of the character's views to be width x height in size. If the

dimensions of sprites in the views differ this can have have strange effects.

Character.DistortFlip(eFlipDirection flip, optional bool portrait)

Flip all frames in the directions specified by the eFlipDirection enumeration.

Character.DistortRotate(int angle, optional bool portrait)

Rotate all frames by the angle given.

Character.DistortTint(int red, int green, int blue, int saturation, int luminance, optional bool portrait)

Tint all frames with the colour and strength given.

Character.DistortRestore(optional bool portrait)

Restore a character's original sprites to those in the editor.

Character.DistortView(int view)

If you need to adjust other views, this repeats the last distortion

that was applied to any character on the view specified.

Configuration

DISTORTABLE_SPRITES

You need to increase this if you're going to apply this to a lot of characters

Assuming each char has 20 frames in each loop, 8 loops each view, 4 views per

character then you have 640 sprites per character. The default, 9600 then lets you

distort 15 characters. However, perhaps more typical is 12*4*2 = 96 sprites per char

which gives you 100 distortable characters.

Example

  cAlice.DistortScale(0.5); // Make half-size
  cAlice.ChangeRoom(rabbithole);
  cAlice.Walk(500, 300, eBlock);
  cAlice.DistortRestore(); // Back to normal

Caveats

None known

Revision History

6 Mar 09: v1.0 First release of DistortChar module

Licence

DistortChar AGS script module

Copyright (C) 2009 Andrew MacCormack

This module is licenced under the Creative Commons Attribution Share-alike

licence, (see http://creativecommons.org/licenses/by-sa/2.5/scotland/ )

which basically means do what you like as long as you credit me and don't

start selling modified copies of this module.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

DEALINGS IN THE SOFTWARE.

In addition to the licences mentioned in the modules themselves, you may choose to use the following creative commons licence if you prefer for all AGS modules and open source code resources on my site.

Creative Commons License
This work is licenced under a Creative Commons Licence.