Ffc (ZScript)

From ZCWiki
Jump to: navigation, search

The keyword ffc specifies that a variable is a pointer (a reference) to a freeform combo (FFC) on the screen.

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.

FFC Properties

The syntax for accessing the properties associated with a ffc type variable is as follows:

ffc-variable->property;

where ffc-variable is a variable of type ffc and property is one of th 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 properties as the evaluation criteria in control loops, if statements, and so forth.

Properties

float Ax

The FFC's acceleration's X-component.

float Ay

The FFC's acceleration's Y-component.

int CSet

The cset of the FFC.

int Data

The number of the combo associated with this FFC.

int Delay

The FFC's animation delay, in frames.

int EffectHeight

The height of the area of effect of the combo associated with the FFC, in pixels.

int EffectWidth

The width of the area of effect of the combo associated with the FFC, in pixels.

bool Flags[]

The FFC's set of flags. Use the FFCF_ constants in std.zh as the index to access a particular flag.

float InitD[]

The original values of the FFC's 8 D input values as the are stored in the .qst file, ignoring any modification they may have received in ZScript.

int Link

The number of the FFC linked to by this FFC.

int TileHeight

The number of tile rows composing the FFC.

int TileWidth

The number of tile columns composing the FFC.

int Script

The number of the script assigned to the FFC. This will be automatically set to 0 when the FFC's script halts.

float Vx

The FFC's velocity's X-component, in pixels per frame.

float Vy

The FFC's velocity's Y-component, in pixels per frame.

float X

The FFC's X position on the screen.

float Y

The FFC's Y position on the screen.

See Also