Graphics

 View Only
  • 1.  Trigger animations using Counter widget

    Posted 03-01-2023 13:44

    I'm in the process of making a game that has an animation that goes up on a right answer and goes down on a wrong answer and I would like to trigger the animations using a score counter widget.  I can make it advance but I don't know how to differentiated the increase/decrease value so I can get it to run the down animations. If it's possible to do it all in Visual logic that would be cool but I was unable to find a visual logic objects that does what I was looking for so I'd understand if I need to run actual scripts. any help is greatly appreciated.  



    ------------------------------
    Jarod Valentin
    ------------------------------


  • 2.  RE: Trigger animations using Counter widget

    Posted 03-01-2023 15:52

    You'll need old number, new number and then calculate the delta. 

    You should connect your widget counter to the text object called new number and place this script OnSetText. 

    dim old, delta as xpTextObject

     

    scene.GetObjectByName("oldValue", old)
    scene.GetObjectByName("deltaValue", delta)

     

    delta.Text = text - old.Text

     

    dim up, down as xpBaseObject

     

    scene.GetSceneDirectorByName("upArrow", up)
    scene.GetSceneDirectorByName("downArrow", down)

     

    if delta.Text > 0
    up.play

    up.autostop = true

    else
    down.play

    down.autostop = true

    end if

     

    old.Text = text



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 3.  RE: Trigger animations using Counter widget

    Posted 03-01-2023 22:17

    cool, thank you for the quick reply!  When I get the opportunity to set this up I'll let you know how it works out.



    ------------------------------
    Jarod Valentin
    ------------------------------