Graphics

 View Only
  • 1.  Score update with sound effect

    Posted 02-07-2015 00:08
    Imagine you are playing a game where you list different examples in a set. (superheroes for example) during a live event at an NBA game. I have designed a timer that counts down and a widget that increments one at a time with each correct answer. Rather than use the manual interface for the widget, I want the operator to be able to use a key sequence (Alt+U) to increment the score, as well as play a sound effect each time the score is updated. I know it is more simple than this description but I'm simply brain blocked on this. Can anyone offer any advice? As always, thank you in advance.


  • 2.  RE: Score update with sound effect

    Posted 02-07-2015 15:26
    You should make a different scene director in the scene. The scene director can have an audio track on it with your sound effect, as well as script event that increments the widget. The script would look something like this

    `dim widget as xpCounterWidget

    engine.GetWidgetByName("score", widget)

    widget.up

    `

    Then use a script in the keyboard mapping menu and assign ALT+U as the hotkey to trigger it. This script would look for a specific scene on the output and if it finds it, then get the scene director from it and play it..

    something like this (not tested, so may have a bug or two).. It looks for a scene on channel 1, layer 0 called "GameScene" and looks for a scene director called "AddScore".

    `dim outfb as xpOutputFramebuffer

    dim scene as xpScene

    dim sd as xpSceneDirector

    engine.GetOutputFramebuffer(0, outfb)

    outfb.GetSceneOnLayer(0, scene)

    if scene.name = "GameScene" then

    scene.GetSceneDirectorByName("AddScore", sd)

    sd.PlayRange(0, 30)

    end if

    `

    #XPression


  • 3.  RE: Score update with sound effect

    Posted 02-07-2015 17:00
    Thanks again Brian for the quick response. I'll give it a try.

    #XPression


  • 4.  RE: Score update with sound effect

    Posted 02-08-2015 00:21
    Works great. Thanks again Brian.

    #XPression