protected static var _originalSeed:Number
Internal random number calculation helpers.
public static var quadTree:FlxQuadTree
The global quad tree (stored here since it is used primarily by FlxU functions).
Set this to null to force it to refresh on the next collide.
public static var quadTreeBounds:FlxRect
This variable stores the dimensions of the root of the quad tree.
This is the eligible game collision space.
public static var roundingError:Number = 0.0000001
Helps to eliminate false collisions and/or rendering glitches caused by rounding errors
protected static var _seed:Number
Internal random number calculation helpers.
seed:Number
[read-write]
Set seed
to a number between 0 and 1 if you want
FlxG.random()
to generate a predictable series of numbers.
NOTE: reading the seed will return the original value passed in,
not the current mutation.
Implementation
public static function get seed():Number
public function set seed(value:Number):void
public static function abs(N:Number):Number
Parameters
Returns
public static function ceil(N:Number):Number
Parameters
Returns
public static function collide(Object1:FlxObject, Object2:FlxObject):Boolean
Call this function to see if one FlxObject
collides with another.
Can be called with one object and one group, or two groups, or two objects,
whatever floats your boat! It will put everything into a quad tree and then
check for collisions. For maximum performance try bundling a lot of objects
together using a FlxGroup
(even bundling groups together!)
NOTE: does NOT take objects' scrollfactor into account.
Parameters
| Object1:FlxObject — The first object or group you want to check.
|
|
| Object2:FlxObject — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.
|
Returns
public static function computeVelocity(Velocity:Number, Acceleration:Number = 0, Drag:Number = 0, Max:Number = 10000):Number
A tween-like function that takes a starting velocity
and some other factors and returns an altered velocity.
Parameters
| Velocity:Number — Any component of velocity (e.g. 20).
|
|
| Acceleration:Number (default = 0 ) — Rate at which the velocity is changing.
|
|
| Drag:Number (default = 0 ) — Really kind of a deceleration, this is how much the velocity changes if Acceleration is not set.
|
|
| Max:Number (default = 10000 ) — An absolute value cap for the velocity.
|
Returns
| Number — The altered Velocity value.
|
public static function floor(N:Number):Number
Parameters
Returns
public static function getAngle(X:Number, Y:Number):Number
Calculates the angle between a point and the origin (0,0).
Parameters
| X:Number — The X coordinate of the point.
|
|
| Y:Number — The Y coordinate of the point.
|
Returns
| Number — The angle in degrees.
|
public static function getClass(Name:String):Class
Look up a Class
object by its string name.
Parameters
| Name:String — The String name of the Class you are interested in.
|
Returns
public static function getClassName(Obj:Object, Simple:Boolean = false):String
Get the String
name of any Object
.
Parameters
| Obj:Object — The Object object in question.
|
|
| Simple:Boolean (default = false ) — Returns only the class name, not the package or packages.
|
Returns
| String — The name of the Class as a String object.
|
public static function mutate(Seed:Number, Mutator:Number):Number
Mutates a seed or other number, useful when combined with randomize()
.
Parameters
| Seed:Number — The number to mutate.
|
|
| Mutator:Number — The value to use in the mutation.
|
Returns
| Number — A predictably-altered version of the Seed.
|
public static function openURL(URL:String):void
Opens a web page in a new tab or window.
Parameters
| URL:String — The address of the web page.
|
public static function overlap(Object1:FlxObject, Object2:FlxObject, Callback:Function = null):Boolean
Call this function to see if one FlxObject
overlaps another.
Can be called with one object and one group, or two groups, or two objects,
whatever floats your boat! It will put everything into a quad tree and then
check for overlaps. For maximum performance try bundling a lot of objects
together using a FlxGroup
(even bundling groups together!)
NOTE: does NOT take objects' scrollfactor into account.
Parameters
| Object1:FlxObject — The first object or group you want to check.
|
|
| Object2:FlxObject — The second object or group you want to check. If it is the same as the first, flixel knows to just do a comparison within that group.
|
|
| Callback:Function (default = null ) — A function with two FlxObject parameters - e.g. myOverlapFunction(Object1:FlxObject,Object2:FlxObject); If no function is provided, FlxQuadTree will call kill() on both objects.
|
Returns
public static function random(UseGlobalSeed:Boolean = true):Number
Generate a pseudo-random number.
Parameters
| UseGlobalSeed:Boolean (default = true ) — Whether or not to use the stored FlxG.seed value to calculate it.
|
Returns
| Number — A pseudo-random Number object.
|
public static function randomize(Seed:Number):Number
Generate a pseudo-random number.
Parameters
| Seed:Number — The number to use to generate a new random value.
|
Returns
| Number — A pseudo-random Number object.
|
public static function rotatePoint(X:Number, Y:Number, PivotX:Number, PivotY:Number, Angle:Number, P:FlxPoint = null):FlxPoint
Rotates a point in 2D space around another point by the given angle.
Parameters
| X:Number — The X coordinate of the point you want to rotate.
|
|
| Y:Number — The Y coordinate of the point you want to rotate.
|
|
| PivotX:Number — The X coordinate of the point you want to rotate around.
|
|
| PivotY:Number — The Y coordinate of the point you want to rotate around.
|
|
| Angle:Number — Rotate the point by this many degrees.
|
|
| P:FlxPoint (default = null ) — Optional FlxPoint to store the results in.
|
Returns
| FlxPoint —
A FlxPoint containing the coordinates of the rotated point.
|
public static function setWorldBounds(X:Number = 0, Y:Number = 0, Width:Number = 0, Height:Number = 0):void
Call this function to specify a more efficient boundary for your game world.
This boundary is used by overlap()
and collide()
, so it
can't hurt to have it be the right size! Flixel will invent a size for you, but
it's pretty huge - 256x the size of the screen, whatever that may be.
Leave width and height empty if you want to just update the game world's position.
Parameters
| X:Number (default = 0 ) — The X-coordinate of the left side of the game world.
|
|
| Y:Number (default = 0 ) — The Y-coordinate of the top of the game world.
|
|
| Width:Number (default = 0 ) — Desired width of the game world.
|
|
| Height:Number (default = 0 ) — Desired height of the game world.
|
public static function solveXCollision(Object1:FlxObject, Object2:FlxObject):Boolean
This quad tree callback function can be used externally as well.
Takes two objects and separates them along their X axis (if possible/reasonable).
Parameters
| Object1:FlxObject — The first object or group you want to check.
|
|
| Object2:FlxObject — The second object or group you want to check.
|
Returns
public static function solveYCollision(Object1:FlxObject, Object2:FlxObject):Boolean
This quad tree callback function can be used externally as well.
Takes two objects and separates them along their Y axis (if possible/reasonable).
Parameters
| Object1:FlxObject — The first object or group you want to check.
|
|
| Object2:FlxObject — The second object or group you want to check.
|
Returns