Property | Type | Description | |
---|---|---|---|
Finished | System.Boolean | ||
FrameHeight | float | ||
FramePixels | Microsoft.Xna.Framework.Graphics.Texture2D | ||
FrameWidth | float | ||
Frames | uint | ||
Offset | |||
Origin | |||
Scale | |||
moving | bool |
Property | Type | Description | |
---|---|---|---|
ImgDefault | Microsoft.Xna.Framework.Graphics.Texture2D | ||
_alpha | float | ||
_animated | System.Boolean | ||
_animations | List |
||
_bakedRotation | float | ||
_callback | Action |
||
_color | Color | ||
_curAnim | |||
_curFrame | int | ||
_curIndex | int | ||
_facing | uint | ||
_flashPoint | |||
_flashPointZero | |||
_flashRect | |||
_flashRect2 | |||
_flipped | uint | ||
_frameTimer | float | ||
_matrix | Matrix | ||
_pixels | Microsoft.Xna.Framework.Graphics.Texture2D | ||
camX | float | ||
camY | float | ||
drawSourceRect | |||
oX | float | ||
oY | float | ||
sourceRect |
Method | Description | |
---|---|---|
FlxSprite ( float x, float y, Microsoft.Xna.Framework.Graphics.Texture2D graphic = null ) : System |
Creates a white 8x8 square
|
|
addAnimation ( String name, int frames, float frameRate, System.Boolean looped = true ) : void |
Adds a new animation to the sprite.
|
|
addAnimationCallback ( Action |
Pass in a function to be called whenever this sprite's animation changes.
|
|
centerOffsets ( bool adjustPosition = false ) : void |
Helper function that adjusts the offset automatically to center the bounding box within the graphic.
|
|
destroy ( ) : void | ||
draw ( ) : void |
Called by game loop, updates then blits or renders current frame of animation to the screen
|
|
drawFrame ( bool force = false ) : void |
Request (or force) that the sprite update the frame before rendering. Useful if you are doing procedural generation or other weirdness!
|
|
drawLine ( float startX, float startY, float endX, float endY, Color color, uint thickness = 1 ) : void |
This function draws a line on this sprite from position X1,Y1 to position X2,Y2 with the specified color.
|
|
fill ( Color color ) : void |
Fills this sprite's graphic with a specific color.
|
|
getVec2 ( ) : Vector2 |
flx# only
|
|
loadGraphic ( Microsoft.Xna.Framework.Graphics.Texture2D graphic, System.Boolean animated = false, System.Boolean reverse = false, float width, float height, bool unique = false ) : |
Load an image from an embedded graphic file.
|
|
loadRotatedGraphic ( Microsoft.Xna.Framework.Graphics.Texture2D graphic, uint rotations = 16, int frame = 1, bool antiAliasing = false, bool autoBuffer = false ) : |
Create a pre-rotated sprite sheet from a simple sprite. This can make a huge difference in graphical performance!
|
|
makeGraphic ( uint width, uint height, Color color, bool unique = false, string key = null ) : |
This function creates a flat colored square image dynamically.
|
|
onScreen ( |
Check and see if this object is currently on screen. Differs from
|
|
pixelOverlapPoint ( |
Checks to see if a point in 2D world space overlaps this
|
|
play ( String animName, System.Boolean force = false ) : void |
Plays an existing animation (e.g. "run"). If you call an animation that is already playing it will be ignored.
|
|
postUpdate ( ) : void |
Automatically called after update() by the game loop, this function just calls updateAnimation().
|
|
randomFrame ( ) : void |
Tell the sprite to change to a random frame of animation Useful for instantiating particles or other weird things.
|
|
replaceColor ( Color color, Color newColor, bool fetchPositions = false ) : List |
Undocumented in Flixel.
|
|
setOriginToCorner ( ) : void |
Helper function that just sets origin to (0,0).
|
|
stamp ( |
This function draws or stamps one
|
Method | Description | |
---|---|---|
calcFrame ( ) : void |
Internal function to update the current animation frame.
|
|
resetHelpers ( ) : void |
Resets some important variables for sprite optimization and rendering.
|
|
updateAnimation ( ) : void |
Internal function for updating the sprite's animation. Useful for cases when you need to update this but are buried down in too many supers. This function is called automatically by
|
public FlxSprite ( float x, float y, Microsoft.Xna.Framework.Graphics.Texture2D graphic = null ) : System | ||
x | float | The initial X position of the sprite. |
y | float | The initial Y position of the sprite. |
graphic | Microsoft.Xna.Framework.Graphics.Texture2D | The graphic you want to display (OPTIONAL - for simple stuff only, do NOT use for animated images!). |
return | System |
public addAnimation ( String name, int frames, float frameRate, System.Boolean looped = true ) : void | ||
name | String | What this animation should be called (e.g. "run"). |
frames | int | An array of numbers indicating what frames to play in what order (e.g. 1, 2, 3). |
frameRate | float | The speed in frames per second that the animation should play at (e.g. 40 fps). |
looped | System.Boolean | Whether or not the animation is looped or just plays once. |
return | void |
public addAnimationCallback ( Action |
||
animationCallback | Action |
A function that has 3 parameters: a string name, a uint frame number, and a uint frame index. |
return | void |
public centerOffsets ( bool adjustPosition = false ) : void | ||
adjustPosition | bool | Adjusts the actual X and Y position just once to match the offset change. Default is false. |
return | void |
public drawFrame ( bool force = false ) : void | ||
force | bool | Force the frame to redraw, even if its not flagged as necessary. |
return | void |
public drawLine ( float startX, float startY, float endX, float endY, Color color, uint thickness = 1 ) : void | ||
startX | float | X coordinate of the line's start point. |
startY | float | Y coordinate of the line's start point. |
endX | float | X coordinate of the line's end point. |
endY | float | Y coordinate of the line's end point. |
color | Color | The line's color. |
thickness | uint | How thick the line is in pixels (default value is 1). |
return | void |
public fill ( Color color ) : void | ||
color | Color | The color with which to fill the graphic, format 0xAARRGGBB. |
return | void |
public loadGraphic ( Microsoft.Xna.Framework.Graphics.Texture2D graphic, System.Boolean animated = false, System.Boolean reverse = false, float width, float height, bool unique = false ) : |
||
graphic | Microsoft.Xna.Framework.Graphics.Texture2D | The image you want to use. |
animated | System.Boolean | Whether the Graphic parameter is a single sprite or a row of sprites. |
reverse | System.Boolean | Whether you need this class to generate horizontally flipped versions of the animation frames. |
width | float | Optional, specify the width of your sprite (helps FlxSprite figure out what to do with non-square sprites or sprite sheets). |
height | float | Optional, specify the height of your sprite (helps FlxSprite figure out what to do with non-square sprites or sprite sheets). |
unique | bool | Optional, whether the graphic should be a unique instance in the graphics cache. Default is false. |
return |
public loadRotatedGraphic ( Microsoft.Xna.Framework.Graphics.Texture2D graphic, uint rotations = 16, int frame = 1, bool antiAliasing = false, bool autoBuffer = false ) : |
||
graphic | Microsoft.Xna.Framework.Graphics.Texture2D | The image you want to rotate and stamp. |
rotations | uint | The number of rotation frames the final sprite should have. For small sprites this can be quite a large number (360 even) without any problems. |
frame | int | If the Graphic has a single row of square animation frames on it, you can specify which of the frames you want to use here. Default is -1, or "use whole graphic." |
antiAliasing | bool | Whether to use high quality rotations when creating the graphic. Default is false. |
autoBuffer | bool | Whether to automatically increase the image size to accomodate rotated corners. Default is false. Will create frames that are 150% larger on each axis than the original frame or graphic. |
return |
public makeGraphic ( uint width, uint height, Color color, bool unique = false, string key = null ) : |
||
width | uint | The width of the sprite you want to generate. |
height | uint | The height of the sprite you want to generate. |
color | Color | Specifies the color of the generated block. |
unique | bool | Whether the graphic should be a unique instance in the graphics cache. Default is false. |
key | string | Optional parameter - specify a string key to identify this graphic in the cache. Trumps Unique flag. |
return |
public onScreen ( |
||
camera | Specify which game camera you want. If null getScreenXY() will just grab the first global camera. | |
return | bool |
public pixelOverlapPoint ( |
||
point | The point in world space you want to check. | |
mask | uint | Used in the pixel hit test to determine what counts as solid. |
camera | Specify which game camera you want. If null getScreenXY() will just grab the first global camera. | |
return | bool |
public play ( String animName, System.Boolean force = false ) : void | ||
animName | String | The string name of the animation you want to play. |
force | System.Boolean | Whether to force the animation to restart. |
return | void |
public replaceColor ( Color color, Color newColor, bool fetchPositions = false ) : List |
||
color | Color | |
newColor | Color | |
fetchPositions | bool | |
return | List |
public stamp ( |
||
brush | The image you want to use as a brush or stamp or pen or whatever. | |
x | int | The X coordinate of the brush's top left corner on this sprite. |
y | int | They Y coordinate of the brush's top left corner on this sprite. |
return | void |
public Texture2D,Microsoft.Xna.Framework.Graphics FramePixels | ||
return | Microsoft.Xna.Framework.Graphics.Texture2D |
protected static Texture2D,Microsoft.Xna.Framework.Graphics ImgDefault | ||
return | Microsoft.Xna.Framework.Graphics.Texture2D |
protected FlxAnim,flxSharp.flxSharp.System _curAnim | ||
return |
protected FlxPoint,flxSharp.flxSharp _flashPointZero | ||
return |
protected Texture2D,Microsoft.Xna.Framework.Graphics _pixels | ||
return | Microsoft.Xna.Framework.Graphics.Texture2D |
protected Rectangle,Microsoft.Xna.Framework drawSourceRect | ||
return |