XNACS1Lib: CSS490 Spring 2011

The XNACS1Primitive type exposes the following members.

Methods

  Name Description
Public method Above
Returns if the center of this primitive is "above" (in y) in relation to the center of otherPrimitive.
Public method AddToAutoDrawSet
Add this primitive to the AutoDrawSet. If this primitive already exists in the draw set, this function call is ignored. By default, all primitive are added into the AutoDrawSet.
Public method Below
Returns if the center of this primitive is "below" (in y) in relation to the center of otherPrimitive.
Public method Collided(XNACS1Primitive)
Determines if this primitive collides with otherPrimitive.
Public method Collided(XNACS1Primitive, Vector2)
Determines if this primitive collides with the otherPrimitive. If true, pos is the colliding position.
Public method Draw
If visible, draws the primitive with the associated text label.
Protected method DrawPrimitive
Draws the primitive.
Public method HasNonZeroVelocity
Retruns if the current velocity is non-zero.
Public method IsInAutoDrawSet
Determines if this primitive is in the AutoDrawSet.
Public method LeftOf
Returns if the center of this primitive is "to the left" (in x) in relation to the center of otherPrimtive
Public method RemoveFromAutoDrawSet
Remove this primitive from the AutoDrawSet. After this function call, this primitive will not be drawn in the application window.
Public method RightOf
Returns if the center of this primitive is "to the right" (in x) in relation to the center of otherPrimitive
Public method SetTextureSpriteAnimationFrames
Sets animation parameters for a sprite sheet primitive. Zero-based first frame column for the beginning sprite in the animation sequence.Zero-based first frame row for the beginning sprite in the animation sequence.Zero-based first frame column for the ending sprite in the animation sequence.Zero-based first frame row for the ending sprite in the animation sequence.How many ticks the animation will pause for on each frame.The behavior of the animation loop.
Public method SetTextureSpriteSheet
Defines a texture specified for a primitive to behave like a sprite sheet with the specified number of sprites. The default sprite to be drawn is the top left sprite in the sheet. Example: The texture for a given primitive has 16 sprites in it, arranged in a 4 by 4 pattern. By default, all 16 sprites will be displayed, stretched to fit the primitive. Calling this method allows you to specify the number of sprites in the texture. The texture of the sprite sheet to be used.The number of columns in the sprite sheet (number of sprites in a single row). Number of rows in the sprite sheet. The padding between sprites and on the top and left edge.
Public method TopOfAutoDrawSet
Make sure this primitive is drawn on top of all other primitives.
Public method TravelPrimitive
Moves the primitive during each update cycle. This function is automacially called for all visible primitives. Default behavior is to move the primitive if: . Primitive is visible (invivislble primitive is not updated) . ShouldTravel is true . HasNonZeroVelocity() is true

Properties

  Name Description
Public property Center
Center of the primitive.
Public property CenterX
X coordinate of the center position of the primitive.
Public property CenterY
Y coordinate of the center position of the primitive.
Public property Color
Color of the primitive. (undefined for PrimitiveSet).
Public property CurrentSpriteSheetFrameX
Gets or Sets the zero-based current sprite column for sprite sheet drawing.
Public property CurrentSpriteSheetFrameY
Gets or Sets the zero-based current sprite row for sprite sheet drawing.
Public property FrontDirection
Sets the front direction of the primitive. Setting FrontDireciton will cause the RotateAngle and NormalDirection of the primitive to be updated accordingly. y default, when RotateAngle is 0, FrontDireciton points towards (1,0) [positive X-direction]. E.g., if we set RotateAngle to 90-degrees, FrontDireciton will be updated accordinlgy to (0,1) [positive y-direciton], or rotated 90-degress in the anit-clockwise direction
Public property Label
Annotated text label to be associated with the primitive.
Public property LabelColor
Color of the anontated text label.
Public property MaxBound
Upper left corner of the primitive.
Public property MinBound
Lower left corner of the Primitive.
Public property NormalDirection
Get or Set the normal direction of the primitive. Setting NormalDirection will update RotateAngle and FrontDirection accordingly.
Public property RotateAngle
Rotate the primitive by the Angle specified (in degree). After the rotation, the FrontDirection of the primitive will be udpated accordingly. By default, when RotateAngle is 0, FrontDireciton points towards (1,0) [positive X-direction]. E.g., if we set RotateAngle to 90-degrees, FrontDireciton will be updated accordinlgy to (0,1) [positive y-direciton], or rotated 90-degress in the anit-clockwise direction
Public property ShouldTravel
Defines if the primitive should move by its current velocity. Defaults to false.
Protected property Size
Get/Set width/height of the primitive.
Protected property SizeX
Width of the primitive.
Protected property SizeY
Height of the primitive. For PrimitiveCircle (diameter), PrimitiveRectangle (height), PrimitiveSet (undefined).
Public property Speed
Get/Set the speed (magnitude of the Velocity vector) for the velocity.
Public property Texture
Texture file name (without the "." or the extension) to cover the primitive.
Public property TextureTintColor
If a primitive has a texture assigned, this will change the tint and or opacity of the texture when drawn, Color.White is no tint or opacity.
Public property UseSpriteSheet
Allow the primitive to draw as a sprite sheet.
Public property UseSpriteSheetAnimation
Allow the primitive to follow a specified sprite sheet animation sequence.
Public property Velocity
Velocity of a primitive. This is a true velocity: with magnitude (speed) and direction for tavel.
Public property VelocityDirection
Get/Set the direction of the velocity.
Public property VelocityX
Get/Set the x-component of the primitive velocity.
Public property VelocityY
Get/Set the y-component of the primitive velocity.
Public property Visible
Whether the primitive is visible.

See Also