| Package | org.ffilmation.engine.core |
| Class | public class fEngine |
| Inheritance | fEngine flash.events.EventDispatcher |
The fEngine class is the main class in the game engine.
Use the fEngine class to create and attach game scenes to your game.
You can also use it to load external swfs containing media you want to add to you scenes.
Once the scenes are created you can go from one to another using the methods in the fEngine class. The class handles all the drawing and screen refreshing.
// Create container
var filmationTest:Sprite = new Sprite()
addChild(filmationTest)
filmationTest.x = 0
filmationTest.y = 100
// Create engine
var film = new fEngine(filmationTest)
// Create scene and listen to load events
var scenel = film.createScene(new fSceneLoader("western.xml"),800,400)
scenel.addEventListener(fScene.CHANGESTAT, actionHandler)
scenel.addEventListener(fScene.LOAD, loadHandler)
function actionHandler(evt:Event) {
trace("EVENT "+evt.target.stat)
}
function loadHandler(evt:Event) {
// Scene is loaded and ready
// Create a camera and make it active
var cam = scenel.createCamera()
scenel.setCamera(cam)
// Render
scenel.render()
film.showScene(scenel)
}
| Property | Defined by | ||
|---|---|---|---|
| bumpMapping : Boolean [static]
This property enables/disables bumpmapping globally.
| fEngine | ||
| characterShadows : Boolean [static]
This property enables/disables shadow projection of characters
| fEngine | ||
| objectShadows : Boolean [static]
This property enables/disables shadow projection of objects
| fEngine | ||
| Method | Defined by | ||
|---|---|---|---|
|
fEngine(container:Sprite)
Constructor for the fEngine class.
| fEngine | ||
|
This method creates an scene from an XML definition file.
| fEngine | ||
|
Hides / disables a scene
| fEngine | ||
|
loadMedia(src:String):*
This method loads an external media file.
| fEngine | ||
|
Makes active one scene in the Engine.
| fEngine | ||
| Constant | Defined by | ||
|---|---|---|---|
| MEDIALOADCOMPLETE : String = "enginemedialoadcomplete" [static]
The fEngine.MEDIALOADCOMPLETE constant defines the value of the
type property of the event object for a enginemedialoadcomplete event. | fEngine | ||
| MEDIALOADPROGRESS : String = "enginemedialoadprogress" [static]
The fEngine.MEDIALOADPROGRESS constant defines the value of the
type property of the event object for a enginemedialoadprogress event. | fEngine | ||
| bumpMapping | property |
bumpMapping:Boolean [read-write]This property enables/disables bumpmapping globally. Please note that for the bumpMapping to work in a given surface and light, the surface will need a bumpMap definition and the light must be defined as bumpmapped. Beware that only fast computers will be able to handle this in realtime
Implementation public static function get bumpMapping():Boolean
public function set bumpMapping(value:Boolean):void
| characterShadows | property |
characterShadows:Boolean [read-write]This property enables/disables shadow projection of characters
Implementation public static function get characterShadows():Boolean
public function set characterShadows(value:Boolean):void
| objectShadows | property |
objectShadows:Boolean [read-write]This property enables/disables shadow projection of objects
Implementation public static function get objectShadows():Boolean
public function set objectShadows(value:Boolean):void
| fEngine | () | constructor |
public function fEngine(container:Sprite)Constructor for the fEngine class.
Parameterscontainer:Sprite — An sprite object where the engine will draw your game
|
| createScene | () | method |
public function createScene(retriever:fEngineSceneRetriever, width:Number, height:Number):fSceneThis method creates an scene from an XML definition file. The scene starts loading and compiling at this moment, but will not be ready to use yet. You should wait for the scene's LOAD event before making it active
Parametersretriever:fEngineSceneRetriever — Any class that implements the fEngineSceneRetriever interface
|
|
width:Number — Width of the viewport, in pixels. This avoids the need of masking the whole sprite
|
|
height:Number — Height of the viewport, in pixels. This avoids the need of masking the whole sprite
|
fScene —
A fScene Object.
|
| hideScene | () | method |
public function hideScene(sc:fScene):voidHides / disables a scene
Parameterssc:fScene — The fScene you want to hide
|
| loadMedia | () | method |
public function loadMedia(src:String):*This method loads an external media file. Once the media file is loaded, the symbols in that file can be used in you scene definitions. Listen to the engine's MEDIALOADPROGRESS and MEDIALOADCOMPLETE to control the process. The class checks if the media is already loaded to avoid duplicate loads.
Parameterssrc:String — Path to the swf file you want to load
|
* |
| showScene | () | method |
public function showScene(sc:fScene):voidMakes active one scene in the Engine. Only one scene can be active ( visible ) at the same time. The current active scene, if any, will me moved to the inactive scene list
Parameterssc:fScene — The fScene you want to activate
|
| MEDIALOADCOMPLETE | constant |
public static const MEDIALOADCOMPLETE:String = "enginemedialoadcomplete"
The fEngine.MEDIALOADCOMPLETE constant defines the value of the
type property of the event object for a enginemedialoadcomplete event.
The event is dispatched when the external media file finishes loading.
| MEDIALOADPROGRESS | constant |
public static const MEDIALOADPROGRESS:String = "enginemedialoadprogress"
The fEngine.MEDIALOADPROGRESS constant defines the value of the
type property of the event object for a enginemedialoadprogress event.
The event is dispatched when there is a progress in loading an external media file, allowing to update a progress bar, for example.