The Scene object represents the currently loaded scene. There is always one and only Scene object available. It's accessible via the Game.Scene attribute. For the convenience the templates automatically store the scene object in a global variable named Scene.
Object manipulation | |
LoadActor | Loads a new actor from a file. |
LoadActor3D | Loads a new 3D actor from a file. |
LoadEntity | Loads a new entity from a file. |
UnloadObject | Removes an object from memory. |
Scrolling functions | |
SkipTo | Sets the current scroll position to the given point / object. |
ScrollTo | Scrolls the scene to the given point / object. |
Node querying functions | |
GetLayer | Returns the given layer. |
GetWaypointGroup | Returns the given waypoint group. |
GetNode | Returns the given scene node (entity or region). |
GetFreeNode | Returns the given free scene node (entity or actor). |
GetRegionAt | Returns a scene region at a given position. |
Scene querying functions | |
IsBlockedAt | Queries whether the scene is blocked at a given point. |
IsWalkableAt | Queries whether the scene is walkable at a given point. |
GetScaleAt | Queries a scale factor at a given point of the scene. |
GetRotationAt | Queries a sprite rotation factor at a given point of the scene. |
IsPointInViewport | Queries whether a given point is lying within the current scene viewport. |
Fading functions | |
FadeOut | Fades the scene out to a specified color. |
FadeIn | Fades the scene in from a specified color. |
GetFadeColor | Gets the current fading color. |
Dynamic object creation | |
CreateEntity | Creates a new entity object. |
DeleteEntity | Destroys a entity object. |
AddLayer | Adds a new layer to the top of the scene |
InsertLayer | Inserts a new layer to the scene |
DeleteLayer | Permanently removes a scene layer |
3D characters related | |
EnableNode3D | Enables a 3D walkplane or blocked object |
DisableNode3D | Disables a 3D walkplane or blocked object |
IsNode3DEnabled | Checks whether a specified 3D walkplane or blocked object is enabled. |
EnableLight | Enables a 3D light within the scene |
DisableLight | Disables a 3D light within the scene |
IsLightEnabled | Checks whether a specified 3D light is enabled. |
SetLightColor | Changes the color of a 3D light |
GetLightColor | Queries the color of a 3D light |
GetLightPosition | Queries the position of a 3D light |
GetLightName | Queries the name of a specified 3D light |
SetActiveCamera | Switches a camera used to display 3D objects in scene |
EnableFog | Enables linear fog within the scene, which affects the 3D actors |
DisableFog | Disables fog within the scene. |
Miscelaneous functions | |
SetViewport | Sets scene viewport to specified values. |
Type (read only) | Returns always "scene" |
Name | The internal name of the scene |
Filename (read only) | Returns the filename. |
Ready (read only) | Returns whether the scene is ready (the scrolling is over) |
NumLayers (read only) | Returns the number of layers |
NumWaypointGroups (read only) | Return the number of waypoint groups |
MouseX (read only) | Returns the current X position of the mouse cursor within the scene |
MouseY (read only) | Returns the current Y position of the mouse cursor within the scene |
MainLayer (read only) | Returns a reference to the scene's main layer |
AutoScroll | Specifies whether scene automatically scrolls to the Game.MainObject |
IsScrolling (read only) | Returns true if the scene is currently scrolling. |
PersistentState | Specifies whether the engine "remembers" the previous state of scene nodes when re-entering the scene |
ScrollSpeedX | Horizontal scrolling speed (in milliseconds, default=10) |
ScrollSpeedY | Vertical scrolling speed (in milliseconds, default=10) |
ScrollPixelsX | Horizontal scrolling shift (in pixels, default=1) |
ScrollPixelsY | Vertical scrolling shift (in pixels, default=1) |
OffsetX | Current horizontal scrolling offset of the scene |
OffsetY | Current vertical scrolling offset of the scene |
Width | Specifies the width of the main scene layer |
Height | Specifies the height of the main scene layer |
NumFreeNodes (read only) | Returns the number of free scene nodes |
GeometryFile (read only) | The filename of the geometry file assigned to scene or null if no geometry is assigned |
ShowGeometry | Specifies if the hidden scene geometry is displayed (for development purposes only) |
MaxShadowType | Specifies the maximum shadow detail to be used in this scene (0..none, 1..simple, 2..flat, 3..stencil shadows) |
AmbientLightColor | The color of the scene ambient light, which affects 3D actors |
NumLights (read only) | Returns the number of 3D lights defined by the hidden scene geometry. |
SceneShutdown | Triggered before the scene is about to be destroyed. Event handler must not contain any blocking command, such as Sleep(), GoTo() etc. |
Loads a new actor from a file.
A reference to the new Actor object. If the method fails, the return value is null.
Actors loaded using this method will be automatically unloaded when the game changes to another scene (as opposed to the Game.LoadActor method).
Loads a new 3D actor from a file.
A reference to the new 3D actor object. If the method fails, the return value is null.
Actors loaded using this method will be automatically unloaded when the game changes to another scene (as opposed to the Game.LoadActor3D method).
Loads a new entity from a file.
A reference to the new Entity object. If the method fails, the return value is null.
Entities loaded using this method will be automatically unloaded when the game changes to another scene (as opposed to the Game.LoadEntity method).
Removes an object from memory.
If you load an object using the Scene.LoadActor or Scene.LoadEntity methods, you should unload those when you no longer need them to free memory. Otherwise those objects will be released automatically when the game changes to another scene.
Sets the current scroll position to the given point / object.
Scrolls the scene to the given point / object.
The Scene.AutoScroll attribute must be set to true for this method to work. ScrollTo method blocks the script execution until the scrolling is over, while the ScrollToAsync method returns immediately.
Returns the given layer.
Returns a reference to the layer object at a given index/with a given name or returns null if there's no such layer.
Returns the given waypoint group.
Returns a reference to the waypoint group object at a given index or null if there's no such waypoint group.
Returns the given scene node (entity or region).
Returns a reference to the scene node object with a given name or null if there's no such node.
The scene nodes should have unique names for this method to work correctly.
Returns the given free scene node (entity or actor).
Returns a reference to the scene node object with a given name/index or null if there's no such node.
Returns a scene region at a given position.
Returns a reference to the scene region object at a given position or null if there's no such region.
Queries whether the scene is blocked at a given point.
Returns true if the scene is blocked at given coordinates.
Queries whether the scene is walkable at a given point.
Returns true if the scene is walkable at given coordinates.
Queries a scale factor at a given point of the scene.
Returns the scale factor at given coordinates (in percent).
Queries a sprite rotation factor at a given point of the scene.
Returns the sprite rotation factor at given coordinates (in degrees).
Queries whether a given point is lying within the current scene viewport.
Returns true if the specified point lies within the scene viewport.
Fades the scene out to a specified color.
The FadeOut method blocks the script execution until the fading is over, while the FadeOutAsync method returns immediately.
Fades the scene in from a specified color.
The FadeIn method blocks the script execution until the fading is over, while the FadeInAsync method returns immediately.
Gets the current fading color.
Returns the current fading color in the encoded color format.
You can use the GetRValue(), GetGValue(), GetBValue() and GetAValue() functions to extract individual color components.
Creates a new entity object.
Returns a reference to the newly created entity.
Destroys a entity object.
Adds a new layer to the top of the scene
Returns a reference to the newly created layer object.
Inserts a new layer to the scene
Returns a reference to the newly created layer object.
Permanently removes a scene layer
Returns true if the layer was successfuly deleted.
Enables a 3D walkplane or blocked object
Returns true if the node has been successfuly enabled.
The scene must have a 3D geometry assigned for this method to work.
Disables a 3D walkplane or blocked object
Returns true if the node has been successfuly disabled.
The scene must have a 3D geometry assigned for this method to work.
Checks whether a specified 3D walkplane or blocked object is enabled.
Returns true if the specified 3D scene node exists and is currently enabled.
Enables a 3D light within the scene
Returns true if the light has been successfuly enabled.
The scene must have a 3D geometry assigned for this method to work.
Disables a 3D light within the scene
Returns true if the light has been successfuly disabled.
The scene must have a 3D geometry assigned for this method to work.
Checks whether a specified 3D light is enabled.
Returns true if the specified light exists and is currently enabled.
Changes the color of a 3D light
Returns true if the light color has been successfuly changed.
The scene must have a 3D geometry assigned for this method to work.
Queries the color of a 3D light
Returns the color of the light in RGB format.
The scene must have a 3D geometry assigned for this method to work. Use the global functions GetRValue(), GetGValue() and GetBValue() to get individual color components.
Queries the position of a 3D light
Returns an object providing three properties, X, Y and Z, representing the light position in 3D space.
The scene must have a 3D geometry assigned for this method to work.
Queries the name of a specified 3D light
Returns the name of the light at specified index or null if the index is invalid.
You can use a loop from 0 to Scene.NumLights - 1 to query the names of all lights in the scene.
Switches a camera used to display 3D objects in scene
Returns true if the camera has been successfuly switched.
The scene must have a 3D geometry assigned for this method to work.
Enables linear fog within the scene, which affects the 3D actors
Use the MakeRGBA() function to encode the color value.
Disables fog within the scene.
Sets scene viewport to specified values.
This method only affects the current scene (unlike Game.SetSceneViewport). Call this method without any parameters to set viewport to full screen.