Ffc (ZScript)
From ZCWiki
The keyword ffc specifies that a variable is a pointer (a reference) to a freeform combo (FFC) on the screen.
Contents |
[edit] Syntax and Initialization
Declare a variable as type ffc as follows:
ffc AnFFC;
Until you initialze the variable, it does not actually "point to" any particular FFC, and thus any properties or methods you attempt to use will be invalid. You must initialize the variable by using the Screen->LoadFFC() method, as follows:
// Load the first FFC on the screen into a variable.
AnFFC = Screen->LoadFFC(1);
Also note that the FFC must be defined on the screen before you can access its methods and properties in ZScript. You define the FFC in ZQuest using the Freeform Combo Editor.
It should be noted, however, that in an ffc script, the ffc that the script is attached to is already declared as 'this' by the compiler, and so can be used without declaration.
[edit] FFC Methods and Properties
The syntax for accessing the methods and properties associated with a ffc type variable is as follows:
ffc-variable->method-or-property;
where ffc-variable is a variable of type ffc and method-or-property is one of the methods or properties listed below. For instance, the following snippet would set the horizontal velocity of the of the first FFC on the screen to 2.
// Create a ffc variable and set it // to the first FFC on the screen ffc AnFFC = Screen->LoadFFC(1);
// Set the horizontal velocity (Vx).
AnFFC->Vx = 2;
As with any expression, you can use these methods or properties as the evaluation criteria in control loops, if statements, and so forth.
[edit] Methods
[edit] bool WasTriggered()
Returns true if and only if the FFC was triggered by a secret.
[edit] Properties
[edit] float Ax
The FFC's acceleration's X-component.
[edit] float Ay
The FFC's acceleration's Y-component.
[edit] int CSet
The cset of the FFC.
[edit] int Data
The number of the combo associated with this FFC.
[edit] int Delay
The FFC's animation delay, in frames.
[edit] int EffectHeight
The height of the area of effect of the combo associated with the FFC, in pixels.
[edit] int EffectWidth
The width of the area of effect of the combo associated with the FFC, in pixels.
[edit] bool Flags[]
The FFC's set of flags. Use the FFCF_ constants in std.zh as the index to access a particular flag.
[edit] int Link
The number of the FFC linked to by this FFC.
[edit] int TileHeight
The number of tile rows composing the FFC.
[edit] int TileWidth
The number of tile columns composing the FFC.
[edit] float Vx
The FFC's velocity's X-component, in pixels per frame.
[edit] float Vy
The FFC's velocity's Y-component, in pixels per frame.
[edit] float X
The FFC's X position on the screen.
[edit] float Y
The FFC's Y position on the screen.
