User Tools

Site Tools


dragengine:modules:dragonscript:gabehavior_interactivemainmenu

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().

State Machine Actions

This behavior adds these state machine actions.

interactiveMainMenu.set

Set interactive main menu parameters.

ParameterValueDescription
fadeInTimefloatDuration in seconds of fading in.
mainCameraSpotstringName of camera spot to use as main camera.
visibletrue, falseShow/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>

interactiveMainMenu.update

Update interactive main menu parameters and run interactive main menu actions.

ParameterValueDescription
activateHotSpot.actionstringActivate hot spot with action assigned.
activeHotSpot.actionstringSet hot spot with action assigned as active hot spot.
loadWorldstringLoad game world from path (.deworld).
deactivateHotSpot Deactivate active hot spot.
reset Reset main menu.
pausetrue, other valuePause/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>

State Machine Conditions

This behavior adds these state machine conditions.

interactiveMainMenu.check

Evaluate interactive main menu parameters.

ParameterValueDescription
visibletrue, falseMain menu is visible.
readytrue, falseMain menu is ready (world loaded and interaction possible).
canLoadWorldtrue, falseMain 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>

State Machine Events

This behavior sends these state machine events.

interactiveMainMenu.action:<name>

Hot spot has been activated which has a name assigned. Action name is appended to event name.

interactiveMainMenu.loadWorld.started

Loading game world started.

interactiveMainMenu.loadWorld.finished

Loading game world finished. Main menu can be used.

interactiveMainMenu.loadWorld.failed

Loading game world failed. Main menu can not be used.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

API Documentation

GABehaviorInteractiveMainMenu.

Since DragonScript Module Version 1.35

Use Cases

  • Create an interactive main menu.

Live Examples

You could leave a comment if you were logged in.
dragengine/modules/dragonscript/gabehavior_interactivemainmenu.txt · Last modified: by dragonlord