Package | org.flixel |
Class | public class FlxText |
Inheritance | FlxText ![]() ![]() ![]() ![]() |
FlxSprite
to support rendering text.
Can tint, fade, rotate and scale just like a sprite.
Doesn't really animate though, as far as I know.
Also does nice pixel-perfect centering on pixel fonts
as long as they are only one liners.
Property | Defined by | ||
---|---|---|---|
![]() | acceleration : FlxPoint
How fast the speed of this object is changing.
| FlxObject | |
![]() | active : Boolean
If an object is not alive, the game loop will not automatically call
update() on it. | FlxObject | |
alignment : String
The alignment of the font ("left", "right", or "center").
| FlxText | ||
![]() | alpha : Number
Set
alpha to a number between 0 and 1 to change the opacity of the sprite. | FlxSprite | |
![]() | angle : Number
Set the angle of a sprite to rotate it.
| FlxObject | |
![]() | angularAcceleration : Number
How fast the spin speed should change.
| FlxObject | |
![]() | angularDrag : Number
Like
drag but for spinning. | FlxObject | |
![]() | angularVelocity : Number
This is how fast you want this sprite to spin.
| FlxObject | |
![]() | antialiasing : Boolean
Controls whether the object is smoothed when rotated, affects performance.
| FlxSprite | |
![]() | blend : String
Blending modes, just like Photoshop!
E.g.
| FlxSprite | |
![]() | bottom : Number
The Y coordinate of the bottom of the rectangle.
| FlxRect | |
![]() | colHullX : FlxRect
These store a couple of useful numbers for speeding up collision resolution.
| FlxObject | |
![]() | colHullY : FlxRect
These store a couple of useful numbers for speeding up collision resolution.
| FlxObject | |
![]() | collideBottom : Boolean
Flag for direction collision resolution.
| FlxObject | |
![]() | collideLeft : Boolean
Flag for direction collision resolution.
| FlxObject | |
![]() | collideRight : Boolean
Flag for direction collision resolution.
| FlxObject | |
![]() | collideTop : Boolean
Flag for direction collision resolution.
| FlxObject | |
![]() | colOffsets : Array
An array of
FlxPoint objects. | FlxObject | |
color : uint
The color of the text being displayed.
| FlxText | ||
![]() | colVector : FlxPoint
These store a couple of useful numbers for speeding up collision resolution.
| FlxObject | |
![]() | dead : Boolean
Handy for tracking gameplay or animations.
| FlxObject | |
![]() | drag : FlxPoint
This isn't drag exactly, more like deceleration that is only applied
when acceleration is not affecting the sprite.
| FlxObject | |
![]() | exists : Boolean
Kind of a global on/off switch for any objects descended from
FlxObject . | FlxObject | |
![]() | facing : uint
Set
facing using FlxSprite.LEFT ,RIGHT ,
UP , and DOWN to take advantage of
flipped sprites and/or just track player orientation more easily. | FlxSprite | |
![]() | finished : Boolean
Whether the current animation has finished its first (or only) loop.
| FlxSprite | |
![]() | fixed : Boolean
Set
fixed to true if you want the object to stay in place during collisions. | FlxObject | |
font : String
The font used for this text.
| FlxText | ||
![]() | frame : uint
Tell the sprite to change to a specific frame of animation.
| FlxSprite | |
![]() | frameHeight : uint
The height of the actual graphic or image being displayed (not necessarily the game object/bounding box).
| FlxSprite | |
![]() | frames : uint
The total number of frames in this image (assumes each row is full).
| FlxSprite | |
![]() | frameWidth : uint
The width of the actual graphic or image being displayed (not necessarily the game object/bounding box).
| FlxSprite | |
![]() | _group : Boolean
Dedicated internal flag for whether or not this class is a FlxGroup.
| FlxObject | |
![]() | health : Number
Handy for storing health percentage or armor points or whatever.
| FlxObject | |
![]() | height : Number | FlxRect | |
![]() | left : Number
The X coordinate of the left side of the rectangle.
| FlxRect | |
![]() | maxAngular : Number
Use in conjunction with
angularAcceleration for fluid spin speed control. | FlxObject | |
![]() | maxThrust : Number
Used to cap
thrust , helpful and easy!
| FlxObject | |
![]() | maxVelocity : FlxPoint
If you are using
acceleration , you can use maxVelocity with it
to cap the speed automatically (very useful!). | FlxObject | |
![]() | moves : Boolean
Set this to false if you want to skip the automatic motion/movement stuff (see
updateMotion() ). | FlxObject | |
![]() | offset : FlxPoint
If you changed the size of your sprite object to shrink the bounding box,
you might need to offset the new bounding box from the top-left corner of the sprite.
| FlxSprite | |
![]() | onFloor : Boolean
Flag that indicates whether or not you just hit the floor.
| FlxObject | |
![]() | origin : FlxPoint
WARNING: The origin of the sprite will default to its center.
| FlxObject | |
![]() | pixels : BitmapData
Set
pixels to any BitmapData object. | FlxSprite | |
![]() | right : Number
The X coordinate of the right side of the rectangle.
| FlxRect | |
![]() | scale : FlxPoint
Change the size of your sprite's graphic.
| FlxSprite | |
![]() | scrollFactor : FlxPoint
A point that can store numbers from 0 to 1 (for X and Y independently)
that governs how much this object is affected by the camera subsystem.
| FlxObject | |
shadow : uint
The alignment of the font ("left", "right", or "center").
| FlxText | ||
size : Number
The size of the text being displayed.
| FlxText | ||
![]() | solid : Boolean
Set
solid to true if you want to collide this object. | FlxObject | |
text : String
The text being displayed.
| FlxText | ||
![]() | thrust : Number
If you want to do Asteroids style stuff, check out thrust,
instead of directly accessing the object's velocity or acceleration.
| FlxObject | |
![]() | top : Number
The Y coordinate of the top of the rectangle.
| FlxRect | |
![]() | velocity : FlxPoint
The basic speed of this object.
| FlxObject | |
![]() | visible : Boolean
If an object is not visible, the game loop will not automatically call
render() on it. | FlxObject | |
![]() | width : Number | FlxRect | |
![]() | x : Number | FlxPoint | |
![]() | y : Number | FlxPoint |
Property | Defined by | ||
---|---|---|---|
![]() | _alpha : Number | FlxSprite | |
![]() | _animations : Array | FlxSprite | |
![]() | _bakedRotation : Number | FlxSprite | |
![]() | _bbb : BitmapData | FlxSprite | |
![]() | _boundsVisible : Boolean | FlxSprite | |
![]() | _caf : uint | FlxSprite | |
![]() | _callback : Function | FlxSprite | |
![]() | _color : uint | FlxSprite | |
![]() | _ct : ColorTransform | FlxSprite | |
![]() | _curAnim : FlxAnim | FlxSprite | |
![]() | _curFrame : uint | FlxSprite | |
![]() | _facing : uint | FlxSprite | |
![]() | _fixed : Boolean
Internal tracker for whether an object will move/alter position after a collision (see
fixed ). | FlxObject | |
![]() | _flashPoint : Point
This is a pre-allocated Flash Point object, which is useful for certain Flash graphics API calls
| FlxObject | |
![]() | _flashPointZero : Point | FlxSprite | |
![]() | _flashRect : Rectangle | FlxSprite | |
![]() | _flashRect2 : Rectangle | FlxSprite | |
![]() | _flicker : Boolean
Internal helper used for retro-style flickering.
| FlxObject | |
![]() | _flickerTimer : Number
Internal helper used for retro-style flickering.
| FlxObject | |
![]() | _flipped : uint | FlxSprite | |
![]() | _framePixels : BitmapData | FlxSprite | |
![]() | _frameTimer : Number | FlxSprite | |
![]() | _gfx : Graphics [static]
| FlxSprite | |
![]() | _gfxSprite : Sprite [static]
| FlxSprite | |
![]() | _mtx : Matrix | FlxSprite | |
![]() | _pixels : BitmapData | FlxSprite | |
![]() | _point : FlxPoint
This is just a pre-allocated x-y point container to be used however you like
| FlxObject | |
![]() | _rect : FlxRect
This is just a pre-allocated rectangle container to be used however you like
| FlxObject | |
_regen : Boolean | FlxText | ||
_shadow : uint | FlxText | ||
![]() | _solid : Boolean
Internal tracker for whether or not the object collides (see
solid ). | FlxObject | |
_tf : TextField | FlxText |
Method | Defined by | ||
---|---|---|---|
FlxText(X:Number, Y:Number, Width:uint, Text:String = null, EmbeddedFont:Boolean = true)
Creates a new
FlxText object at the specified position. | FlxText | ||
![]() |
addAnimation(Name:String, Frames:Array, FrameRate:Number = 0, Looped:Boolean = true):void
Adds a new animation to the sprite.
| FlxSprite | |
![]() |
addAnimationCallback(AnimationCallback:Function):void
Pass in a function to be called whenever this sprite's animation changes.
| FlxSprite | |
![]() |
If you don't want to call
FlxU.collide() you can use this instead. | FlxObject | |
![]() |
createGraphic(Width:uint, Height:uint, Color:uint = 0xffffffff, Unique:Boolean = false, Key:String = null):FlxSprite
This function creates a flat colored square image dynamically.
| FlxSprite | |
![]() |
destroy():void
Called by
FlxGroup , commonly when game states are changed. | FlxObject | |
![]() |
This function draws or stamps one
FlxSprite onto another. | FlxSprite | |
![]() |
drawLine(StartX:Number, StartY:Number, EndX:Number, EndY:Number, Color:uint, Thickness:uint = 1):void
This function draws a line on this sprite from position X1,Y1
to position X2,Y2 with the specified color.
| FlxSprite | |
![]() |
fill(Color:uint):void
Fills this sprite's graphic with a specific color.
| FlxSprite | |
![]() |
flicker(Duration:Number = 1):void
Tells this object to flicker, retro-style.
| FlxObject | |
![]() |
flickering():Boolean
Check to see if the object is still flickering.
| FlxObject | |
![]() |
getBoundingColor():uint
Returns the appropriate color for the bounding box depending on object state.
| FlxObject | |
![]() |
Call this function to figure out the on-screen position of the object.
| FlxSprite | |
![]() |
Called when this object's bottom edge collides with the top of another
FlxObject . | FlxObject | |
![]() |
Called when this object's left side collides with another
FlxObject 's right. | FlxObject | |
![]() |
Called when this object's right side collides with another
FlxObject 's left. | FlxObject | |
![]() |
Since most games have identical behavior for running into walls,
you can just override this function instead of overriding both hitLeft and hitRight.
| FlxObject | |
![]() |
Called when this object's top collides with the bottom of another
FlxObject . | FlxObject | |
![]() |
hurt(Damage:Number):void
Call this function to "damage" (or give health bonus) to this sprite.
| FlxObject | |
![]() |
kill():void
Call this function to "kill" a sprite so that it no longer 'exists'.
| FlxObject | |
![]() |
loadGraphic(Graphic:Class, Animated:Boolean = false, Reverse:Boolean = false, Width:uint = 0, Height:uint = 0, Unique:Boolean = false):FlxSprite
Load an image from an embedded graphic file.
| FlxSprite | |
![]() |
loadRotatedGraphic(Graphic:Class, Rotations:uint = 16, Frame:int = -1, AntiAliasing:Boolean = false, AutoBuffer:Boolean = false):FlxSprite
Create a pre-rotated sprite sheet from a simple sprite.
| FlxSprite | |
![]() |
onEmit():void
Triggered whenever this sprite is launched by a
FlxEmitter . | FlxSprite | |
![]() |
onScreen():Boolean
Check and see if this object is currently on screen.
| FlxObject | |
![]() |
Checks to see if some
FlxObject object overlaps this FlxObject object. | FlxObject | |
![]() |
overlapsPoint(X:Number, Y:Number, PerPixel:Boolean = false):Boolean
Checks to see if a point in 2D space overlaps this FlxCore object.
| FlxSprite | |
![]() |
play(AnimName:String, Force:Boolean = false):void
Plays an existing animation (e.g.
| FlxSprite | |
![]() |
preCollide(Object:FlxObject):void
FlxU.collide() (and thus FlxObject.collide() ) call
this function each time two objects are compared to see if they collide. | FlxObject | |
![]() |
randomFrame():void
Tell the sprite to change to a random frame of animation
Useful for instantiating particles or other weird things.
| FlxSprite | |
![]() |
refreshHulls():void
Called by
FlxObject.updateMotion() and some constructors to
rebuild the basic collision data for this object. | FlxObject | |
![]() |
render():void
Called by game loop, updates then blits or renders current frame of animation to the screen
| FlxSprite | |
![]() |
reset(X:Number, Y:Number):void
Handy function for reviving game objects.
| FlxObject | |
setFormat(Font:String = null, Size:Number = 8, Color:uint = 0xffffff, Alignment:String = null, ShadowColor:uint = 0):FlxText
You can use this if you have a lot of text parameters
to set instead of the individual properties.
| FlxText | ||
![]() |
toString():String
Convert object to readable string name.
| FlxPoint | |
![]() |
unsafeBind(Pixels:BitmapData):void
Internal function, currently only used to quickly update FlxState.screen for post-processing.
| FlxSprite | |
![]() |
update():void
Main game loop update function.
| FlxSprite |
Method | Defined by | ||
---|---|---|---|
calcFrame():void
Internal function to update the current animation frame.
| FlxText | ||
![]() |
drawBounds():void
| FlxSprite | |
dtfCopy():TextFormat
A helper function for updating the
TextField that we use for rendering. | FlxText | ||
![]() |
renderSprite():void
Internal function that performs the actual sprite rendering, called by render().
| FlxSprite | |
![]() |
resetHelpers():void
Resets some important variables for sprite optimization and rendering.
| FlxSprite | |
![]() |
updateAnimation():void
Internal function for updating the sprite's animation.
| FlxSprite | |
![]() |
updateFlickering():void
Just updates the retro-style flickering.
| FlxObject | |
![]() |
updateMotion():void
Internal function for updating the position and speed of this object.
| FlxObject |
alignment | property |
alignment:String
[read-write]The alignment of the font ("left", "right", or "center").
Implementation public function get alignment():String
public function set alignment(value:String):void
color | property |
color:uint
[read-write]The color of the text being displayed.
Implementation public function get color():uint
public function set color(value:uint):void
font | property |
font:String
[read-write]The font used for this text.
Implementation public function get font():String
public function set font(value:String):void
_regen | property |
protected var _regen:Boolean
_shadow | property |
protected var _shadow:uint
shadow | property |
shadow:uint
[read-write]The alignment of the font ("left", "right", or "center").
Implementation public function get shadow():uint
public function set shadow(value:uint):void
size | property |
size:Number
[read-write]The size of the text being displayed.
Implementation public function get size():Number
public function set size(value:Number):void
text | property |
text:String
[read-write]The text being displayed.
Implementation public function get text():String
public function set text(value:String):void
_tf | property |
protected var _tf:TextField
FlxText | () | constructor |
public function FlxText(X:Number, Y:Number, Width:uint, Text:String = null, EmbeddedFont:Boolean = true)
Creates a new FlxText
object at the specified position.
X:Number — The X position of the text.
|
|
Y:Number — The Y position of the text.
|
|
Width:uint — The width of the text object (height is determined automatically).
|
|
Text:String (default = null ) — The actual text you would like to display initially.
|
|
EmbeddedFont:Boolean (default = true ) — Whether this text field uses embedded fonts or nto
|
calcFrame | () | method |
protected override function calcFrame():void
Internal function to update the current animation frame.
dtfCopy | () | method |
protected function dtfCopy():TextFormat
A helper function for updating the TextField
that we use for rendering.
TextFormat — A writable copy of TextField.defaultTextFormat .
|
setFormat | () | method |
public function setFormat(Font:String = null, Size:Number = 8, Color:uint = 0xffffff, Alignment:String = null, ShadowColor:uint = 0):FlxText
You can use this if you have a lot of text parameters to set instead of the individual properties.
ParametersFont:String (default = null ) — The name of the font face for the text display.
|
|
Size:Number (default = 8 ) — The size of the font (in pixels essentially).
|
|
Color:uint (default = 0xffffff ) — The color of the text in traditional flash 0xRRGGBB format.
|
|
Alignment:String (default = null ) — A string representing the desired alignment ("left,"right" or "center").
|
|
ShadowColor:uint (default = 0 ) — A uint representing the desired text shadow color in flash 0xRRGGBB format.
|
FlxText —
This FlxText instance (nice for chaining stuff together, if you're into that).
|