A_SPosAttack
		
		
		
		
		
		Jump to navigation
		Jump to search
		 This page describes a function made for one of the natively supported games. These functions are made with very specific purpose and provide no flexibility, so using them in custom projects is not recommended. Authors are encouraged to use one of the more generalized functions in custom projects. For example: A_CustomBulletAttack.
 This page describes a function made for one of the natively supported games. These functions are made with very specific purpose and provide no flexibility, so using them in custom projects is not recommended. Authors are encouraged to use one of the more generalized functions in custom projects. For example: A_CustomBulletAttack.
		
	
 This page describes a function made for one of the natively supported games. These functions are made with very specific purpose and provide no flexibility, so using them in custom projects is not recommended. Authors are encouraged to use one of the more generalized functions in custom projects. For example: A_CustomBulletAttack.
 This page describes a function made for one of the natively supported games. These functions are made with very specific purpose and provide no flexibility, so using them in custom projects is not recommended. Authors are encouraged to use one of the more generalized functions in custom projects. For example: A_CustomBulletAttack.void A_SPosAttack()
Usage
The attack of Doom's Shotgun Guy. This shoots three bullets and plays the sound "shotguy/attack".
It is equivalent of:
TNT1 A 0 bright A_StartSound("shotguy/attack", CHAN_WEAPON); SPOS F 10 bright A_CustomBulletAttack(22.5, 0, 3, random[SPosAttack](1,5)*3, "BulletPuff", 0, CBAF_NORANDOM);
ZScript definition
	void A_SPosAttack()
	{
		if (target)
		{
			A_StartSound("shotguy/attack", CHAN_WEAPON);
			A_SPosAttackInternal();
		}
	}
	private void A_SPosAttackInternal()
	{
		if (target)
		{
			A_FaceTarget();
			double bangle = angle;
			double slope = AimLineAttack(bangle, MISSILERANGE);
		
			for (int i=0 ; i<3 ; i++)
			{
				double ang = bangle + Random2[SPosAttack]() * (22.5/256);
				int damage = Random[SPosAttack](1, 5) * 3;
				LineAttack(ang, MISSILERANGE, slope, damage, "Hitscan", "Bulletpuff");
			}
		}
    }
Examples
See ShotgunGuy.
