A_SetScale
void A_SetScale (double scalex, double scaley = 0, int ptr = AAPTR_DEFAULT, bool usezero = false)
Usage
Changes the calling actor's or the pointed to actor's visual scale. This does not affect the actual collision box and is mainly intended for special effects actors, such as a puff of smoke gradually dissipating by expansion (in combination with A_FadeOut) or a mote of light shrinking and disappearing.
Note: In ZScript this function can be considered effectively deprecated, since the scale field and its x and y components can be modified directly.
|
Parameters
- scaleX: the actor's new horizontal scale. Using negative values will result in mirroring the sprite on the axis.
- scaleY: the actor's new vertical scale. If this parameter is not given, or is set to 0, scaleX is used as well. Default is 0.
- pointer: The DECORATE actor pointer whose scale should be changed. Default is AAPTR_DEFAULT, which corresponds to the calling actor.
- usezero: If this is false and scaleY is 0, scaleY uses the same value passed to scaleX, otherwise if it is true, the value of scaleY is used, instead. Default is false.
Examples
DECORATE (deprecated) example. This simple actor when spawned will gradually become smaller and more translucent, until it is completely invisible and is removed. It could be used as a trail for some energy-like weapons.
ACTOR PulseRifleSmoke { States { Spawn: TNT1 A 0 A_SetScale(0.6) PMIS B 1 bright A_FadeOut(0.1) TNT1 B 0 A_SetScale(0.5) PMIS B 1 bright A_FadeOut(0.1) TNT1 B 0 A_SetScale(0.4) PMIS B 1 bright A_FadeOut(0.1) TNT1 B 0 A_SetScale(0.3) PMIS B 1 bright A_FadeOut(0.1) TNT1 B 0 A_SetScale(0.2) PMIS B 1 bright A_FadeOut(0.1) TNT1 B 0 A_SetScale(0.1) PMIS B 1 bright A_FadeOut(0.1) wait } }
In ZScript the same effect is achievable through direct manipulation:
class PulseRifleSmoke
{
Default
{
// Flags recommended for objects that don't need
// to interact with the level, like smoke:
+NOINTERACTION
+NOBLOCKMAP
}
States
{
Spawn:
PMIS BBBBBBBB 1
{
scale -= default.scale*0.15; //reduces scale by 15% of the original value with every call
A_FadeOut(0.1);
}
PMIS B 1 A_FadeOut(0.05);
wait;
}
}
Additive scaling changes is also possible, such as scale *= 1.05
or scale *= 0.98
. It's also possible to directly set scale.x
and scale.y
to explicit values.