Click or drag to resize
PlanBaseStopSprite Method
Stops the sprite's current motion

Namespace: (Default Namespace)
Assembly: Default (in Default.exe) Version: 1.0.0.0
Syntax
C#
public virtual void StopSprite(
	SpriteBase Sprite
)

Parameters

Sprite
Type: (Default Namespace)SpriteBase
Sprite to be stopped
Remarks
This stops the current sprite from moving by setting its dx and dy values to zero. This may be desired when a sprite reaches a coordinate in a path where it's supposed to wait, otherwise the sprite may continue to drift while it waits. One easy way to determine when a sprite is waiting at a coordinate is to check if the sprite's wait counter parameter is zero. The wait counter will only be non-zero when the sprite is waiting.
Examples
The following example shows the code used for a sprite named "Plasma 1" that follows a path and stops and waits at coordinates that have a non-zero weight.
C#
// If active
if (<see cref="M:PlanBase.IsSpriteActive(SpriteBase)" />(m_ParentLayer.m_Plasma_1))
{
   // If not waiting
   if ((m_ParentLayer.m_Plasma_1.WaitCounter == 0))
   {
      // Move sprite towards coordinate
      <see cref="M:PlanBase.PushSpriteTowardCoordinate(SpriteBase,System.Int32,System.Int32)" />(m_ParentLayer.m_Plasma_1, m_ParentLayer.m_Plasma_1.CoordIndex, 40);
   }
   else
   {
      // Else stop sprite
      <see cref="M:PlanBase.StopSprite(SpriteBase)" />(m_ParentLayer.m_Plasma_1);
   }
   // Move to next coordinate
  m_ParentLayer.m_Plasma_1.CoordIndex = <see cref="M:PlanBase.CheckNextCoordinate(SpriteBase,System.Int32,System.Int32@)" />(m_ParentLayer.m_Plasma_1, m_ParentLayer.m_Plasma_1.CoordIndex, ref m_ParentLayer.m_Plasma_1.WaitCounter);
}
See Also