AimTarget
Jump to navigation
Jump to search
Actor AimTarget ()
Usage
Fires a hitscan at the direction the caller is facing to find another actor. This function is also used by A_Mushroom and A_JumpIfCloser.
Return value
Returns a pointer to the actor that was found by the hitscan, if no actor was found, then no pointer will be returned.
Examples
This Pistol-derived class has a special alt fire, that prints out the class name of the of the actor in front of the player to the console, if any.
Class ScannerPistol : Pistol
{
Actor FoundActor; //Pointer to the actor that was found.
States
{
AltFire:
PISG A 16
{
Invoker.FoundActor = AimTarget(); //Set the actor found by AimTarget() as the FoundActor.
If (Invoker.FoundActor)
{
A_StartSound ("Misc/Chat",CHAN_WEAPON,CHANF_OVERLAP);
Console.Printf ("There is a %s in front of you.",Invoker.FoundActor.GetClassName());
Invoker.FoundActor = Null; //Remove pointer for the next AltFire.
}
Else
{
A_StartSound ("Misc/Chat",CHAN_WEAPON,CHANF_OVERLAP);
Console.Printf ("No actor was found !");
}
}
Goto Ready;
}
}