class flixel.addons.nape.FlxNapeState extends FlxState

Available on all platforms

FlxNapeState is a FlxState that integrates nape.space.Space * to provide Nape physics simulation in Flixel. * Extend this state, add some FlxNapeSprite(s) to start using flixel + nape physics. * Note that space is a static variable, use FlxNapeState.space * to access it. * * @author TiagoLr ( ~~~ProG4mr~~~ )

Class Fields

static var debug:ShapeDebug

Contains the sprite used for nape debug graphics.

static var space:Space

The space where the nape physics simulation occur.

Instance Fields

var napeDebugEnabled:Bool

Whether the nape debug graphics are enabled or not.

var positionIterations:Int

The number of iterations used by nape in resolving errors in the positions of objects. This is far more lightweight than * velocity iterations, is well as being less important for the stability of results. (default 10)

var velocityIterations:Int

The number of iterations used by nape in resolving errors in the velocities of objects. This is together with collision * detection the most expensive phase of a simulation update, as well as the most important for stable results. (default 10)

function new(?MaxSize:Int):Void

function create():Void

Override this method like a normal FlxState, but add * super.create() to it, so that this function is called.

function createWalls(?MinX:Float = 0, ?MinY:Float = 0, ?MaxX:Float = 0, ?MaxY:Float = 0, ?Thickness:Float = 10, ?_Material:Material = null):Body

Creates simple walls around game area - usefull for prototying. * *

MinX

The smallest X value of your level (usually 0). *

MinY

The smallest Y value of your level (usually 0). *

MaxX

The largest X value of your level - 0 means FlxG.width (usually the level width). *

MaxY

The largest Y value of your level - 0 means FlxG.height (usually the level height). *

Thickness

How thick the walls are. 10 by default. *

_Material

The Material to use for the physics body of the walls.

function destroy():Void

Override this function to null out variables or manually call destroy() * on class members if necessary. Don't forget to call super.destroy()!

function draw():Void

Override this method to draw debug physics shapes

function update():Void

Override this method and add super.update().