| Package | net.flashpunk |
| Class | public class World |
| Inheritance | World Tweener |
| Property | Defined by | ||
|---|---|---|---|
![]() | active : Boolean = true
If the Tweener should update.
| Tweener | |
![]() | autoClear : Boolean = false
If the Tweener should clear on removal.
| Tweener | |
| camera : Point
Point used to determine drawing offset in the render loop.
| World | ||
| count : uint [read-only]
How many Entities are in the World.
| World | ||
| farthest : Entity
[read-only]
The Entity that will be rendered first by the World.
| World | ||
| first : Entity
[read-only]
The first Entity in the World.
| World | ||
| layerFarthest : int [read-only]
The layer that will be rendered first by the World.
| World | ||
| layerNearest : int [read-only]
The layer that will be rendered last by the World.
| World | ||
| layers : uint [read-only]
How many Entity layers the World has.
| World | ||
| mouseX : int [read-only]
X position of the mouse in the World.
| World | ||
| mouseY : int [read-only]
Y position of the mouse in the world.
| World | ||
| nearest : Entity
[read-only]
The Entity that will be rendered last by the world.
| World | ||
| uniqueTypes : uint [read-only]
How many different types have been added to the World.
| World | ||
| visible : Boolean = true
If the render() loop is performed.
| World | ||
| Method | Defined by | ||
|---|---|---|---|
|
World()
Constructor.
| World | ||
|
Adds the Entity to the World at the end of the frame.
| World | ||
|
Adds an Entity to the World with the Graphic object.
| World | ||
|
addList(... list):void
Adds multiple Entities to the world.
| World | ||
|
Adds an Entity to the World with the Mask object.
| World | ||
![]() |
Adds a new Tween.
| Tweener | |
|
begin():void
Override this; called when World is switch to, and set to the currently active world.
| World | ||
|
bringForward(e:Entity):Boolean
Shifts the Entity one place towards the front of its contained layer.
| World | ||
|
bringToFront(e:Entity):Boolean
Brings the Entity to the front of its contained layer.
| World | ||
|
classCount(c:Class):uint
Returns the amount of Entities of the Class are in the World.
| World | ||
|
classFirst(c:Class):Entity
The first Entity of the Class.
| World | ||
|
clearRecycled(classType:Class):void
[static]
Clears stored reycled Entities of the Class type.
| World | ||
|
clearRecycledAll():void
[static]
Clears stored recycled Entities of all Class types.
| World | ||
![]() |
clearTweens():void
Removes all Tweens.
| Tweener | |
|
collideLine(type:String, fromX:int, fromY:int, toX:int, toY:int, precision:uint = 1, p:Point = null):Entity
Returns the first Entity found that collides with the line.
| World | ||
|
collidePoint(type:String, pX:Number, pY:Number):Entity
Returns the first Entity found that collides with the position.
| World | ||
|
collidePointInto(type:String, pX:Number, pY:Number, into:Object):void
Populates an array with all Entities that collide with the position.
| World | ||
|
collideRect(type:String, rX:Number, rY:Number, rWidth:Number, rHeight:Number):Entity
Returns the first Entity that collides with the rectangular area.
| World | ||
|
collideRectInto(type:String, rX:Number, rY:Number, rWidth:Number, rHeight:Number, into:Object):void
Populates an array with all Entities that collide with the rectangle.
| World | ||
|
Returns a new Entity, or a stored recycled Entity if one exists.
| World | ||
|
end():void
Override this; called when World is changed, and the active world is no longer this.
| World | ||
|
focusGained():void
Override this; called when game gains focus.
| World | ||
|
focusLost():void
Override this; called when game loses focus.
| World | ||
|
getAll(into:Object):void
Pushes all Entities in the World into the array.
| World | ||
|
getClass(c:Class, into:Object):void
Pushes all Entities in the World of the Class into the Array or Vector.
| World | ||
|
getInstance(name:String):*
Returns the Entity with the instance name, or null if none exists.
| World | ||
|
getLayer(layer:int, into:Object):void
Pushes all Entities in the World on the layer into the Array or Vector.
| World | ||
|
getType(type:String, into:Object):void
Pushes all Entities in the World of the type into the Array or Vector.
| World | ||
|
If the Entity as at the back of its layer.
| World | ||
|
If the Entity as at the front of its layer.
| World | ||
|
layerCount(layer:int):uint
Returns the amount of Entities are on the layer in the World.
| World | ||
|
layerFirst(layer:int):Entity
The first Entity on the Layer.
| World | ||
|
The last Entity on the Layer.
| World | ||
|
Finds the Entity nearest to another.
| World | ||
|
nearestToPoint(type:String, x:Number, y:Number, useHitboxes:Boolean = false):Entity
Finds the Entity nearest to the position.
| World | ||
|
nearestToRect(type:String, x:Number, y:Number, width:Number, height:Number, ignore:Entity = null):Entity
Finds the Entity nearest to the rectangle.
| World | ||
|
Removes the Entity from the World at the end of the frame and recycles it.
| World | ||
|
Removes the Entity from the World at the end of the frame.
| World | ||
|
removeAll():void
Removes all Entities from the World at the end of the frame.
| World | ||
|
removeList(... list):void
Removes multiple Entities from the world.
| World | ||
![]() |
Removes a Tween.
| Tweener | |
|
render():void
Performed by the game loop, renders all contained Entities.
| World | ||
|
sendBackward(e:Entity):Boolean
Shifts the Entity one place towards the back of its contained layer.
| World | ||
|
sendToBack(e:Entity):Boolean
Sends the Entity to the back of its contained layer.
| World | ||
|
typeCount(type:String):uint
Returns the amount of Entities of the type are in the World.
| World | ||
|
The first Entity of the type.
| World | ||
|
update():void
Performed by the game loop, updates all contained Entities.
| World | ||
|
updateLists():void
Updates the add/remove lists at the end of the frame.
| World | ||
![]() |
updateTweens():void
Updates all contained tweens.
| Tweener | |
| camera | property |
public var camera:PointPoint used to determine drawing offset in the render loop.
| count | property |
count:uint [read-only]How many Entities are in the World.
Implementation public function get count():uint
| farthest | property |
farthest:Entity [read-only]The Entity that will be rendered first by the World.
Implementation public function get farthest():Entity
| first | property |
first:Entity [read-only]The first Entity in the World.
Implementation public function get first():Entity
| layerFarthest | property |
layerFarthest:int [read-only]The layer that will be rendered first by the World.
Implementation public function get layerFarthest():int
| layerNearest | property |
layerNearest:int [read-only]The layer that will be rendered last by the World.
Implementation public function get layerNearest():int
| layers | property |
layers:uint [read-only]How many Entity layers the World has.
Implementation public function get layers():uint
| mouseX | property |
mouseX:int [read-only]X position of the mouse in the World.
Implementation public function get mouseX():int
| mouseY | property |
mouseY:int [read-only]Y position of the mouse in the world.
Implementation public function get mouseY():int
| nearest | property |
nearest:Entity [read-only]The Entity that will be rendered last by the world.
Implementation public function get nearest():Entity
| uniqueTypes | property |
uniqueTypes:uint [read-only]How many different types have been added to the World.
Implementation public function get uniqueTypes():uint
| visible | property |
public var visible:Boolean = trueIf the render() loop is performed.
| World | () | constructor |
public function World()Constructor.
| add | () | method |
public function add(e:Entity):EntityAdds the Entity to the World at the end of the frame.
Parameterse:Entity — Entity object you want to add.
|
Entity —
The added Entity object.
|
| addGraphic | () | method |
public function addGraphic(graphic:Graphic, layer:int = 0, x:int = 0, y:int = 0):EntityAdds an Entity to the World with the Graphic object.
Parametersgraphic:Graphic — Graphic to assign the Entity.
|
|
layer:int (default = 0) — X position of the Entity.
|
|
x:int (default = 0) — Y position of the Entity.
|
|
y:int (default = 0) — Layer of the Entity.
|
Entity —
The Entity that was added.
|
| addList | () | method |
public function addList(... list):voidAdds multiple Entities to the world.
Parameters... list — Several Entities (as arguments) or an Array/Vector of Entities.
|
| addMask | () | method |
public function addMask(mask:Mask, type:String, x:int = 0, y:int = 0):EntityAdds an Entity to the World with the Mask object.
Parametersmask:Mask — Mask to assign the Entity.
|
|
type:String — Collision type of the Entity.
|
|
x:int (default = 0) — X position of the Entity.
|
|
y:int (default = 0) — Y position of the Entity.
|
Entity —
The Entity that was added.
|
| begin | () | method |
public function begin():voidOverride this; called when World is switch to, and set to the currently active world.
| bringForward | () | method |
public function bringForward(e:Entity):BooleanShifts the Entity one place towards the front of its contained layer.
Parameterse:Entity — The Entity to shift.
|
Boolean — If the Entity changed position.
|
| bringToFront | () | method |
public function bringToFront(e:Entity):BooleanBrings the Entity to the front of its contained layer.
Parameterse:Entity — The Entity to shift.
|
Boolean — If the Entity changed position.
|
| classCount | () | method |
public function classCount(c:Class):uintReturns the amount of Entities of the Class are in the World.
Parametersc:Class — The Class type to count.
|
uint — How many Entities of Class exist in the World.
|
| classFirst | () | method |
public function classFirst(c:Class):EntityThe first Entity of the Class.
Parametersc:Class — The Class type to check.
|
Entity —
The Entity.
|
| clearRecycled | () | method |
public static function clearRecycled(classType:Class):voidClears stored reycled Entities of the Class type.
ParametersclassType:Class — The Class type to clear.
|
| clearRecycledAll | () | method |
public static function clearRecycledAll():voidClears stored recycled Entities of all Class types.
| collideLine | () | method |
public function collideLine(type:String, fromX:int, fromY:int, toX:int, toY:int, precision:uint = 1, p:Point = null):EntityReturns the first Entity found that collides with the line.
Parameterstype:String — The Entity type to check for.
|
|
fromX:int — Start x of the line.
|
|
fromY:int — Start y of the line.
|
|
toX:int — End x of the line.
|
|
toY:int — End y of the line.
|
|
precision:uint (default = 1) |
|
p:Point (default = null) |
Entity |
| collidePoint | () | method |
public function collidePoint(type:String, pX:Number, pY:Number):EntityReturns the first Entity found that collides with the position.
Parameterstype:String — The Entity type to check for.
|
|
pX:Number — X position.
|
|
pY:Number — Y position.
|
Entity —
The collided Entity, or null if none collide.
|
| collidePointInto | () | method |
public function collidePointInto(type:String, pX:Number, pY:Number, into:Object):voidPopulates an array with all Entities that collide with the position. This function does not empty the array, that responsibility is left to the user.
Parameterstype:String — The Entity type to check for.
|
|
pX:Number — X position.
|
|
pY:Number — Y position.
|
|
into:Object — The Array or Vector to populate with collided Entities.
|
| collideRect | () | method |
public function collideRect(type:String, rX:Number, rY:Number, rWidth:Number, rHeight:Number):EntityReturns the first Entity that collides with the rectangular area.
Parameterstype:String — The Entity type to check for.
|
|
rX:Number — X position of the rectangle.
|
|
rY:Number — Y position of the rectangle.
|
|
rWidth:Number — Width of the rectangle.
|
|
rHeight:Number — Height of the rectangle.
|
Entity —
The first Entity to collide, or null if none collide.
|
| collideRectInto | () | method |
public function collideRectInto(type:String, rX:Number, rY:Number, rWidth:Number, rHeight:Number, into:Object):voidPopulates an array with all Entities that collide with the rectangle. This function does not empty the array, that responsibility is left to the user.
Parameterstype:String — The Entity type to check for.
|
|
rX:Number — X position of the rectangle.
|
|
rY:Number — Y position of the rectangle.
|
|
rWidth:Number — Width of the rectangle.
|
|
rHeight:Number — Height of the rectangle.
|
|
into:Object — The Array or Vector to populate with collided Entities.
|
| create | () | method |
public function create(classType:Class, addToWorld:Boolean = true):EntityReturns a new Entity, or a stored recycled Entity if one exists.
ParametersclassType:Class — The Class of the Entity you want to add.
|
|
addToWorld:Boolean (default = true) — Add it to the World immediately.
|
Entity —
The new Entity object.
|
| end | () | method |
public function end():voidOverride this; called when World is changed, and the active world is no longer this.
| focusGained | () | method |
public function focusGained():voidOverride this; called when game gains focus.
| focusLost | () | method |
public function focusLost():voidOverride this; called when game loses focus.
| getAll | () | method |
public function getAll(into:Object):voidPushes all Entities in the World into the array.
Parametersinto:Object — The Array or Vector to populate.
|
| getClass | () | method |
public function getClass(c:Class, into:Object):voidPushes all Entities in the World of the Class into the Array or Vector.
Parametersc:Class — The Class type to check.
|
|
into:Object — The Array or Vector to populate.
|
| getInstance | () | method |
public function getInstance(name:String):*Returns the Entity with the instance name, or null if none exists.
Parametersname:String — Instance name of the Entity.
|
* — An Entity in this world.
|
| getLayer | () | method |
public function getLayer(layer:int, into:Object):voidPushes all Entities in the World on the layer into the Array or Vector.
Parameterslayer:int — The layer to check.
|
|
into:Object — The Array or Vector to populate.
|
| getType | () | method |
public function getType(type:String, into:Object):voidPushes all Entities in the World of the type into the Array or Vector.
Parameterstype:String — The type to check.
|
|
into:Object — The Array or Vector to populate.
|
| isAtBack | () | method |
public function isAtBack(e:Entity):BooleanIf the Entity as at the back of its layer.
Parameterse:Entity — The Entity to check.
|
Boolean — True or false.
|
| isAtFront | () | method |
public function isAtFront(e:Entity):BooleanIf the Entity as at the front of its layer.
Parameterse:Entity — The Entity to check.
|
Boolean — True or false.
|
| layerCount | () | method |
public function layerCount(layer:int):uintReturns the amount of Entities are on the layer in the World.
Parameterslayer:int — The layer to count Entities on.
|
uint — How many Entities are on the layer.
|
| layerFirst | () | method |
public function layerFirst(layer:int):EntityThe first Entity on the Layer.
Parameterslayer:int — The layer to check.
|
Entity —
The Entity.
|
| layerLast | () | method |
public function layerLast(layer:int):EntityThe last Entity on the Layer.
Parameterslayer:int — The layer to check.
|
Entity —
The Entity.
|
| nearestToEntity | () | method |
public function nearestToEntity(type:String, e:Entity, useHitboxes:Boolean = false):EntityFinds the Entity nearest to another.
Parameterstype:String — The Entity type to check for.
|
|
e:Entity — The Entity to find the nearest to.
|
|
useHitboxes:Boolean (default = false) — If the Entities' hitboxes should be used to determine the distance. If false, their x/y coordinates are used.
|
Entity —
The nearest Entity to e.
|
| nearestToPoint | () | method |
public function nearestToPoint(type:String, x:Number, y:Number, useHitboxes:Boolean = false):EntityFinds the Entity nearest to the position.
Parameterstype:String — The Entity type to check for.
|
|
x:Number — X position.
|
|
y:Number — Y position.
|
|
useHitboxes:Boolean (default = false) — If the Entities' hitboxes should be used to determine the distance. If false, their x/y coordinates are used.
|
Entity —
The nearest Entity to the position.
|
| nearestToRect | () | method |
public function nearestToRect(type:String, x:Number, y:Number, width:Number, height:Number, ignore:Entity = null):EntityFinds the Entity nearest to the rectangle.
Parameterstype:String — The Entity type to check for.
|
|
x:Number — X position of the rectangle.
|
|
y:Number — Y position of the rectangle.
|
|
width:Number — Width of the rectangle.
|
|
height:Number — Height of the rectangle.
|
|
ignore:Entity (default = null) — Ignore this entity.
|
Entity —
The nearest Entity to the rectangle.
|
| recycle | () | method |
public function recycle(e:Entity):EntityRemoves the Entity from the World at the end of the frame and recycles it. The recycled Entity can then be fetched again by calling the create() function.
Parameterse:Entity — The Entity to recycle.
|
Entity —
The recycled Entity.
|
| remove | () | method |
public function remove(e:Entity):EntityRemoves the Entity from the World at the end of the frame.
Parameterse:Entity — Entity object you want to remove.
|
Entity —
The removed Entity object.
|
| removeAll | () | method |
public function removeAll():voidRemoves all Entities from the World at the end of the frame.
| removeList | () | method |
public function removeList(... list):voidRemoves multiple Entities from the world.
Parameters... list — Several Entities (as arguments) or an Array/Vector of Entities.
|
| render | () | method |
public function render():voidPerformed by the game loop, renders all contained Entities. If you override this to give your World render code, remember to call super.render() or your Entities will not be rendered.
| sendBackward | () | method |
public function sendBackward(e:Entity):BooleanShifts the Entity one place towards the back of its contained layer.
Parameterse:Entity — The Entity to shift.
|
Boolean — If the Entity changed position.
|
| sendToBack | () | method |
public function sendToBack(e:Entity):BooleanSends the Entity to the back of its contained layer.
Parameterse:Entity — The Entity to shift.
|
Boolean — If the Entity changed position.
|
| typeCount | () | method |
public function typeCount(type:String):uintReturns the amount of Entities of the type are in the World.
Parameterstype:String — The type (or Class type) to count.
|
uint — How many Entities of type exist in the World.
|
| typeFirst | () | method |
public function typeFirst(type:String):EntityThe first Entity of the type.
Parameterstype:String — The type to check.
|
Entity —
The Entity.
|
| update | () | method |
public override function update():voidPerformed by the game loop, updates all contained Entities. If you override this to give your World update code, remember to call super.update() or your Entities will not be updated.
| updateLists | () | method |
public function updateLists():voidUpdates the add/remove lists at the end of the frame.