| Package | org.ffilmation.engine.core |
| Class | public class fScene |
| Inheritance | fScene flash.events.EventDispatcher |
The fScene class provides control over a scene in your application. The API for this object is used to add and remove elements from the scene after it has been loaded, and managing cameras.
Moreover, you can get information on topology, visibility from one point to another, search for paths and other useful methods that will help, for example, in programming AIs that move inside the scene.
| Property | Defined by | ||
|---|---|---|---|
| AI : fAiContainer
The AI-related method are grouped inside this object, for easier access
| fScene | ||
| all : Array
An array of all elements in this scene, use it with ID Strings
| fScene | ||
| characters : Array
An array of all characters for fast loop access.
| fScene | ||
| container : Sprite
Were scene is drawn
| fScene | ||
| controller : fEngineSceneController
Assigns a controller to this scene
| fScene | ||
| depth : Number
Scene depth in pixels
| fScene | ||
| environmentLight : fGlobalLight
The global light for this scene.
| fScene | ||
| everything : Array
An array of all elements for fast loop access.
| fScene | ||
| floors : Array
An array of all floors for fast loop access.
| fScene | ||
| id : String | fScene | ||
| lights : Array
An array of all lights for fast loop access.
| fScene | ||
| objects : Array
An array of all objects for fast loop access.
| fScene | ||
| ready : Boolean
Indicates if the scene is loaded and ready
| fScene | ||
| stat : String
An string indicating the scene's current status
| fScene | ||
| walls : Array
An array of all walls for fast loop access.
| fScene | ||
| width : Number
Scene width in pixels.
| fScene | ||
| Method | Defined by | ||
|---|---|---|---|
|
fScene(engine:fEngine, container:Sprite, retriever:fEngineSceneRetriever, width:Number, height:Number)
Constructor.
| fScene | ||
|
Creates a new camera associated to the scene
| fScene | ||
|
createCharacter(idchar:String, def:String, x:Number, y:Number, z:Number):fCharacter
Creates a new character an adds it to the scene
| fScene | ||
|
createOmniLight(idlight:String, x:Number, y:Number, z:Number, size:Number, color:String, intensity:Number, decay:Number, bumpMapped:Boolean):fOmniLight
Creates a new light and adds it to the scene.
| fScene | ||
|
disable():void
This Method is called to disable the scene.
| fScene | ||
|
enable():void
This Method is called to enable the scene.
| fScene | ||
|
removeCharacter(char:fCharacter):void
Removes a character from the scene.
| fScene | ||
|
removeOmniLight(light:fOmniLight):void
Removes an omni light from the scene.
| fScene | ||
|
This method sets the active camera for this scene.
| fScene | ||
|
translate3DCoordsTo2DCoords(x:Number, y:Number, z:Number):Point
This method translates scene 3D coordinates to 2D coordinates relative to the Sprite containing the scene
| fScene | ||
|
translate3DCoordsToStageCoords(x:Number, y:Number, z:Number):Point
This method translates scene 3D coordinates to 2D coordinates relative to the Stage
| fScene | ||
|
translateStageCoordsTo3DCoords(x:Number, y:Number):Point
This method translates Stage coordinates to scene coordinates.
| fScene | ||
| Constant | Defined by | ||
|---|---|---|---|
| LOADCOMPLETE : String = "sceneloadcomplete" [static]
The fScene.LOADCOMPLETE constant defines the value of the
type property of the event object for a sceneloadcomplete event. | fScene | ||
| LOADPROGRESS : String = "scenecloadprogress" [static]
The fScene.LOADPROGRESS constant defines the value of the
type property of the event object for a scenecloadprogress event. | fScene | ||
| AI | property |
public var AI:fAiContainerThe AI-related method are grouped inside this object, for easier access
| all | property |
public var all:ArrayAn array of all elements in this scene, use it with ID Strings
| characters | property |
public var characters:ArrayAn array of all characters for fast loop access. For "id" access use the .all array
| container | property |
public var container:SpriteWere scene is drawn
| controller | property |
controller:fEngineSceneController [read-write]Assigns a controller to this scene
Implementation public function get controller():fEngineSceneController
public function set controller(value:fEngineSceneController):void
| depth | property |
public var depth:NumberScene depth in pixels
| environmentLight | property |
public var environmentLight:fGlobalLightThe global light for this scene. Use this property to change light properties such as intensity and color
| everything | property |
public var everything:ArrayAn array of all elements for fast loop access. For "id" access use the .all array
| floors | property |
public var floors:ArrayAn array of all floors for fast loop access. For "id" access use the .all array
| id | property |
public var id:String
| lights | property |
public var lights:ArrayAn array of all lights for fast loop access. For "id" access use the .all array
| objects | property |
public var objects:ArrayAn array of all objects for fast loop access. For "id" access use the .all array
| ready | property |
public var ready:BooleanIndicates if the scene is loaded and ready
| stat | property |
public var stat:StringAn string indicating the scene's current status
| walls | property |
public var walls:ArrayAn array of all walls for fast loop access. For "id" access use the .all array
| width | property |
public var width:NumberScene width in pixels.
| fScene | () | constructor |
public function fScene(engine:fEngine, container:Sprite, retriever:fEngineSceneRetriever, width:Number, height:Number)Constructor. Don't call directly, use fEngine.createScene() instead
Parametersengine:fEngine |
|
container:Sprite |
|
retriever:fEngineSceneRetriever |
|
width:Number |
|
height:Number |
| createCamera | () | method |
public function createCamera():fCameraCreates a new camera associated to the scene
ReturnsfCamera —
an fCamera object ready to move or make active using the setCamera() method
|
| createCharacter | () | method |
public function createCharacter(idchar:String, def:String, x:Number, y:Number, z:Number):fCharacterCreates a new character an adds it to the scene
Parametersidchar:String — The unique id that will identify the character
|
|
def:String — Definition id. Must match a definition in some of the definition XMLs included in the scene
|
|
x:Number — Initial x coordinate for the character
|
|
y:Number — Initial x coordinate for the character
|
|
z:Number — Initial x coordinate for the character
|
fCharacter |
| createOmniLight | () | method |
public function createOmniLight(idlight:String, x:Number, y:Number, z:Number, size:Number, color:String, intensity:Number, decay:Number, bumpMapped:Boolean):fOmniLightCreates a new light and adds it to the scene. You won't see the light until you call its render() or moveTo() methods
Parametersidlight:String — The unique id that will identify the light
|
|
x:Number — Initial x coordinate for the light
|
|
y:Number — Initial x coordinate for the light
|
|
z:Number — Initial x coordinate for the light
|
|
size:Number — Radius of the sphere that identifies the light
|
|
color:String — An string specifying the color of the light in HTML format, example: #ffeedd
|
|
intensity:Number — Intensity of the light goes from 0 to 100
|
|
decay:Number — From 0 to 100 marks the distance along the lights's radius from where intensity starrts to fade fades. A 0 decay defines a solid light
|
|
bumpMapped:Boolean — Determines if this light will be rendered with bumpmapping. Please note that for the bumpMapping to work in a given surface,
the surface will need a bumpMap definition and bumpMapping must be enabled in the engine's global parameters
|
fOmniLight |
| disable | () | method |
public function disable():voidThis Method is called to disable the scene. It will disable all controllers associated to the scene and its elements. The engine calls this method when the scene is hidden, but you can call it manually too. A typical use of manual enabling/disabling of scenes is pausing the game or showing a dialog box of any type.
See also
| enable | () | method |
public function enable():voidThis Method is called to enable the scene. It will enable all controllers associated to the scene and its elements. The engine calls this method when the scene is shown, but you can call it manually too. A typical use of manual enabling/disabling of scenes is pausing the game or showing a dialog box of any type.
See also
| removeCharacter | () | method |
public function removeCharacter(char:fCharacter):voidRemoves a character from the scene. This is not the same as hiding the character, this removes the element completely from the scene
Parameterschar:fCharacter — The character to be removed
|
| removeOmniLight | () | method |
public function removeOmniLight(light:fOmniLight):voidRemoves an omni light from the scene. This is not the same as hiding the light, this removes the element completely from the scene
Parameterslight:fOmniLight — The light to be removed
|
| setCamera | () | method |
public function setCamera(camera:fCamera):voidThis method sets the active camera for this scene. The camera position determines the viewable area of the scene
Parameterscamera:fCamera — The camera you want to be active
|
| translate3DCoordsTo2DCoords | () | method |
public function translate3DCoordsTo2DCoords(x:Number, y:Number, z:Number):PointThis method translates scene 3D coordinates to 2D coordinates relative to the Sprite containing the scene
Parametersx:Number — x-axis coordinate
|
|
y:Number — y-axis coordinate
|
|
z:Number — z-axis coordinate
|
Point — A Point in this scene's container Sprite
|
| translate3DCoordsToStageCoords | () | method |
public function translate3DCoordsToStageCoords(x:Number, y:Number, z:Number):PointThis method translates scene 3D coordinates to 2D coordinates relative to the Stage
Parametersx:Number — x-axis coordinate
|
|
y:Number — y-axis coordinate
|
|
z:Number — z-axis coordinate
|
Point — A Coordinate in the Stage
|
| translateStageCoordsTo3DCoords | () | method |
public function translateStageCoordsTo3DCoords(x:Number, y:Number):PointThis method translates Stage coordinates to scene coordinates. Useful to map mouse events into game events
Parametersx:Number — x-axis coordinate
|
|
y:Number — y-axis coordinate
|
Point — A Point in the scene's coordinate system. Please note that a Z value is not returned as It can't be calculated from a 2D input.
The returned x and y correspond to z=0 in the game's coordinate system.
|
function mouseClick(evt:MouseEvent) {
var coords:Point = this.scene.translateStageCoordsTo3DCoords(evt.stageX, evt.stageY)
this.hero.character.teleportTo(coords.x,coords.y, this.hero.character.z)
}
| LOADCOMPLETE | constant |
public static const LOADCOMPLETE:String = "sceneloadcomplete"
The fScene.LOADCOMPLETE constant defines the value of the
type property of the event object for a sceneloadcomplete event.
The event is dispatched when the scene finishes loading and processing and is ready to be used
| LOADPROGRESS | constant |
public static const LOADPROGRESS:String = "scenecloadprogress"
The fScene.LOADPROGRESS constant defines the value of the
type property of the event object for a scenecloadprogress event.
The event is dispatched when the status of the scene changes during scene loading and processing.
A listener to this event can then check the scene's status property to update a progress dialog