Packageorg.wak.scene
Classpublic class Scene
InheritanceScene Inheritance flash.display.Sprite

Scene is used to manage the logic of a scene inside the game



Public Properties
 PropertyDefined by
  bookMode : Boolean
Scene
Protected Properties
 PropertyDefined by
  mActiveWalkBehind : WalkBehindArea = null
Scene
  mAmbientSound : Sound = null
Scene
  mAmbientSoundChan : SoundChannel = null
Scene
  mBookModeEnabled : Boolean = false
Scene
  mCharactersOnScene : Array = null
Scene
  mCurrentSelectedInteractable : ISceneInteractable = null
Scene
  mDrawLayer : Sprite = null
Scene
  mOnPlayerWalkCompleteFunc : Function = null
Scene
  mResMngr : Class = null
Scene
  mSceneId : String = ""
Scene
  mStageHeight : Number = 0
[static]
Scene
  mStageWidth : Number = 0
[static]
Scene
Public Methods
 MethodDefined by
  
Constructor
Scene
  
Add a new Scene Item to the Scene
Scene
  
Scene
  
GetGatespot(pGatespotId:String):GateSpot
Get a scene GateSpot by destination.
Scene
  
Get an Scene item from the scene
Scene
  
Return the center position of a tile in pixels
Scene
  
MoveCharacterTo(pCharId:String, pX:Number, pY:Number, pOnCompleteFunc:Function = null):void
Moves the Scene's PlayerDisplay of the character in pCharId to the pX, pY coordinates by walking.
Scene
  
OnClick(event:MouseEvent):void
Handle click, start solving
Scene
  
OnEnterScene():void
Method called when the players enters the Scene.
Scene
  
OnExitScene():void
Method called when the players exits the Scene.
Scene
  
Removes an ISceneInteractable from the scene
Scene
  
SetPlayerDisplayFromScene(pFromSceneId:String):void
If there are two scenes connected by a GateSpots.
Scene
  
SetWalkTiles(pTilesArr:Array, pWalkable:Boolean):void
Scene
  
Update(event:Event):void
Main Loop Update method.
Scene
Protected Methods
 MethodDefined by
  
AngleInTwoIntPoints(pPointA:IntPoint, pPointB:IntPoint):Number
Calculate the angle between two differents IntPoints.
Scene
  
capturingHandler(e:Event):void
Scene
  
CleanHeroRoute(pTileRoute:Array):Array
Clean the AStar results to have a continuous walk.
Scene
  
createCursor(size:Number, col:uint):Shape
Make a rounded to mark a position.
Scene
  
drawLine(a:IntPoint, b:IntPoint, col:uint, width:Number = 1):void
Draw a line from a to b
Scene
  
FindWalkableGoal(pStart:IntPoint, pGoal:IntPoint):void
Find a walkable goal when the clicked tile is not walkable.
Scene
  
Init():void
Initialize internal stuff to set the Scene to run.
Scene
  
InitScroll():void
Scene
  
mapToScreenCoord(pTileCoord:int):Number
Return the center position of a tile in pixels works for both coordinates x or y.
Scene
  
OnAddedToStage(event:Event):void
Listener of the ADDED_TO_STAGE .
Scene
  
Scene
  
OnRemovedFromStage(event:Event):void
Listener of the REMOVED_FROM_STAGE .
Scene
  
screenToMap(pX:Number, pY:Number):IntPoint
On which tile is a point on the screen?
Scene
  
SetWalkBlockedTiles(pTMap:TileMap, pWalkBlockArray:Array, pWalkable:Boolean = false):void
Place in the tile map the walk blocked or unblocked tiles received in pWalkBlockArray.
Scene
  
Place the cursors on their positions.
Scene
  
UpdateDepth():void
Update the Depth position of the Depth managed objects.
Scene
  
Updates the PlayerRenderer Size accordly to its position in the Scene.
Scene
  
UpdateScroll():void
Updates the scroll of the Scene accordly to the player's position.
Scene
  
Scene
Property detail
bookModeproperty
bookMode:Boolean  [read-write]Implementation
    public function get bookMode():Boolean
    public function set bookMode(value:Boolean):void
mActiveWalkBehindproperty 
protected var mActiveWalkBehind:WalkBehindArea = null
mAmbientSoundproperty 
protected var mAmbientSound:Sound = null
mAmbientSoundChanproperty 
protected var mAmbientSoundChan:SoundChannel = null
mBookModeEnabledproperty 
protected var mBookModeEnabled:Boolean = false
mCharactersOnSceneproperty 
protected var mCharactersOnScene:Array = null
mCurrentSelectedInteractableproperty 
protected var mCurrentSelectedInteractable:ISceneInteractable = null
mDrawLayerproperty 
protected var mDrawLayer:Sprite = null
mOnPlayerWalkCompleteFuncproperty 
protected var mOnPlayerWalkCompleteFunc:Function = null
mResMngrproperty 
protected var mResMngr:Class = null
mSceneIdproperty 
protected var mSceneId:String = ""
mStageHeightproperty 
protected static var mStageHeight:Number = 0
mStageWidthproperty 
protected static var mStageWidth:Number = 0
Constructor detail
Scene()constructor
public function Scene(pDef:ISceneDefinition)

Constructor

Parameters
pDef:ISceneDefinition — wich defines the main Scene's data.
Method detail
addInteractableItem()method
public function addInteractableItem(pNewItem:ISceneInteractable):void

Add a new Scene Item to the Scene

Parameters
pNewItem:ISceneInteractable — the new LItem to add in the Scene.
AngleInTwoIntPoints()method 
protected function AngleInTwoIntPoints(pPointA:IntPoint, pPointB:IntPoint):Number

Calculate the angle between two differents IntPoints.

Parameters
pPointA:IntPoint
 
pPointB:IntPoint

Returns
Number
capturingHandler()method 
protected function capturingHandler(e:Event):voidParameters
e:Event
CleanHeroRoute()method 
protected function CleanHeroRoute(pTileRoute:Array):Array

Clean the AStar results to have a continuous walk.

Parameters
pTileRoute:Array

Returns
Array
createCursor()method 
protected function createCursor(size:Number, col:uint):Shape

Make a rounded to mark a position.

Parameters
size:Number — size of the square marker.
 
col:uint — color of the cursor.

Returns
Shape
DetectGateSpotsCollision()method 
public function DetectGateSpotsCollision():void
drawLine()method 
protected function drawLine(a:IntPoint, b:IntPoint, col:uint, width:Number = 1):void

Draw a line from a to b

Parameters
a:IntPoint
 
b:IntPoint
 
col:uint
 
width:Number (default = 1)
FindWalkableGoal()method 
protected function FindWalkableGoal(pStart:IntPoint, pGoal:IntPoint):void

Find a walkable goal when the clicked tile is not walkable.

Parameters
pStart:IntPoint
 
pGoal:IntPoint
GetGatespot()method 
public function GetGatespot(pGatespotId:String):GateSpot

Get a scene GateSpot by destination.

Parameters
pGatespotId:String — gatespot id.

Returns
GateSpot — GateSpot.
GetSceneItem()method 
public function GetSceneItem(pItemId:String):ISceneInteractable

Get an Scene item from the scene

Parameters
pItemId:String — id of the item

Returns
ISceneInteractable — ISceneInteractable if the item is on the scene.
Init()method 
protected function Init():void

Initialize internal stuff to set the Scene to run.

InitScroll()method 
protected function InitScroll():void
mapToScreen()method 
public function mapToScreen(p:IntPoint):Point

Return the center position of a tile in pixels

Parameters
p:IntPoint

Returns
Point
mapToScreenCoord()method 
protected function mapToScreenCoord(pTileCoord:int):Number

Return the center position of a tile in pixels works for both coordinates x or y.

Parameters
pTileCoord:int

Returns
Number
MoveCharacterTo()method 
public function MoveCharacterTo(pCharId:String, pX:Number, pY:Number, pOnCompleteFunc:Function = null):void

Moves the Scene's PlayerDisplay of the character in pCharId to the pX, pY coordinates by walking.

Parameters
pCharId:String — horizontal coordinate on the scene
 
pX:Number — vertical coordinate on the scene.
 
pY:Number
 
pOnCompleteFunc:Function (default = null)
OnAddedToStage()method 
protected function OnAddedToStage(event:Event):void

Listener of the ADDED_TO_STAGE .

Parameters
event:Event
OnClick()method 
public function OnClick(event:MouseEvent):void

Handle click, start solving

Parameters
event:MouseEvent
OnEnterScene()method 
public function OnEnterScene():void

Method called when the players enters the Scene.

OnExitScene()method 
public function OnExitScene():void

Method called when the players exits the Scene.

OnPlayerWalkCompleted()method 
protected function OnPlayerWalkCompleted():void
OnRemovedFromStage()method 
protected function OnRemovedFromStage(event:Event):void

Listener of the REMOVED_FROM_STAGE .

Parameters
event:Event
RemoveInteractable()method 
public function RemoveInteractable(pItem:ISceneInteractable):void

Removes an ISceneInteractable from the scene

Parameters
pItem:ISceneInteractable — ISceneInteractable to remove.
screenToMap()method 
protected function screenToMap(pX:Number, pY:Number):IntPoint

On which tile is a point on the screen?

Parameters
pX:Number
 
pY:Number

Returns
IntPoint
SetPlayerDisplayFromScene()method 
public function SetPlayerDisplayFromScene(pFromSceneId:String):void

If there are two scenes connected by a GateSpots. If the player came from scene A the player display will be placed near the GateSpot which jumps back to the scene A. If there is no corresponding GateSpot no change of coordinates will be made.

Parameters
pFromSceneId:String — Scene id where the player came from.
SetWalkBlockedTiles()method 
protected function SetWalkBlockedTiles(pTMap:TileMap, pWalkBlockArray:Array, pWalkable:Boolean = false):void

Place in the tile map the walk blocked or unblocked tiles received in pWalkBlockArray.

Parameters
pTMap:TileMap — Tilemap to set the non walkable tiles.
 
pWalkBlockArray:Array — list of IntPoint with the tiles to set non walkable.
 
pWalkable:Boolean (default = false)
SetWalkTiles()method 
public function SetWalkTiles(pTilesArr:Array, pWalkable:Boolean):voidParameters
pTilesArr:Array
 
pWalkable:Boolean
Update()method 
public function Update(event:Event):void

Main Loop Update method.

Parameters
event:Event
updateCursors()method 
protected function updateCursors():void

Place the cursors on their positions.

UpdateDepth()method 
protected function UpdateDepth():void

Update the Depth position of the Depth managed objects.

UpdatePerspective()method 
protected function UpdatePerspective():void

Updates the PlayerRenderer Size accordly to its position in the Scene.

UpdateScroll()method 
protected function UpdateScroll():void

Updates the scroll of the Scene accordly to the player's position.

WalkDestinationReached()method 
protected function WalkDestinationReached():void