Start Page » DragonScript Scripting Language » Abstraction Layers: How you want to build your Game » Behavior Elements » GABehaviorInteractiveMainMenu
Game application behavior adding an InteractiveMainMenu to the desktop. The main menu uses a main camera spot and hot spots which can be activated to run actions or load a game world. This creates an interactive main menu which is not just static buttons with an animated background. The main menu is controlled through actions and conditions of the application state machine, see GABehaviorStateMachine.
To access this behavior from other application behaviors use GABehaviorInteractiveMainMenu.getBehaviorInApp().
This behavior adds these state machine actions.
Set interactive main menu parameters.
| Parameter | Value | Description |
|---|---|---|
| fadeInTime | float | Duration in seconds of fading in. |
| mainCameraSpot | string | Name of camera spot to use as main camera. |
| visible | true, false | Show/hide main menu. |
This is an example of using this action to show the main menu:
<action name='interactiveMainMenu.set'> <parameter name='fadeInTime'>1.5</parameter> <parameter name='mainCameraSpot'>main</parameter> <parameter name='visible'>true</parameter> </action>
Update interactive main menu parameters and run interactive main menu actions.
| Parameter | Value | Description |
|---|---|---|
| activateHotSpot.action | string | Activate hot spot with action assigned. |
| activeHotSpot.action | string | Set hot spot with action assigned as active hot spot. |
| loadWorld | string | Load game world from path (.deworld). |
| deactivateHotSpot | Deactivate active hot spot. | |
| reset | Reset main menu. | |
| pause | true, other value | Pause/resume main menu. While paused no interaction is possible and no processing is done not reducing performance. |
This is an example of using this action to load a game world:
<action name='interactiveMainMenu.update'> <parameter name='loadWorld'>/content/worlds/mainMenu.deworld</parameter> </action>
This behavior adds these state machine conditions.
Evaluate interactive main menu parameters.
| Parameter | Value | Description |
|---|---|---|
| visible | true, false | Main menu is visible. |
| ready | true, false | Main menu is ready (world loaded and interaction possible). |
| canLoadWorld | true, false | Main menu is constructed state and loading world is valid. |
This is an example of using this condition to check that a game world can be loaded:
<action name='myAction'> <condition>interactiveMainMenu.check</condition> <parameter name='canLoadWorld'>true</parameter> </action>
This behavior sends these state machine events.
Hot spot has been activated which has a name assigned. Action name is appended to event name.
Loading game world started.
Loading game world finished. Main menu can be used.
Loading game world failed. Main menu can not be used.
This behavior requires no other behaviors.
GABehaviorInteractiveMainMenu.
Since DragonScript Module Version 1.35