Forum Discussion

JenniferIsab000's avatar
JenniferIsab000
Community Member
4 years ago

Evaluate Variable To Determine Motion Path

I have am creating knowledge check questions and depending upon the answers provided, the learner will move to a different base on the baseball diamond. Learners select one of four baseballs to reveal a question. Since they can select any of the four baseballs, I want Storyline to evaluate which base they are on when they click to reveal a question and if they select the correct option SL will evaluate the points total to determine if the player should move to first base, second base, third base or back to home. The problem I am having is that I am not sure what is needed so that SL can evaluate the points total to know that a value of 1 is first base, value of 2 is second base etc. Hoping you can help me. Thanks. 

  • NedWhiteley's avatar
    NedWhiteley
    Community Member

    Hi Jennifer,

    There is nothing wrong in the way you are evaluating your variable. Your problem is caused by the way you have set up your motion paths.

    If you set up a motion path that starts 4 centimetres away from your character, the character will jump those 4 centimetres when it starts its motion path, which is why it is disappearing off the screen after it has reached first base. In your case, you have set up the motion paths to run between the various bases, but the motion path will move with the character and so, by the time the character arrives at first base, the motion path has actually moved off the top of the screen.

    To get round this problem, what you need to do is to set up your four motion paths to move the character in the four directions from the character's start position. The trick is to then go to the Path Options and select Relative Start Point for each motion path. This will ensure that the character then moves along the appropriate motion path relative to the position it is currently in:

    I have made the necessary adjustments in the attached version of your original SL file. If you have any queries, just get back to me here.

    The other advantage of using relative start points with motion paths is that, in your case, you could even use another variable for incorrect responses and then penalise your user for, say, two incorrect responses and send them back one base.

    Hope this helps.

  • Hi Ned, thank you so much, it was such a mystery for me. I tried and tried but had no idea it was the motion path being 4 CMs from my character creating the problem. Thank you so much. Also, thanks for the relative start point tip, this is new territory for me :-). 

  • Help, I think I have the wrong trigger order. I want to make it so that when a user selects a  random ball to reveal a question and that they have to select the correct answer before they can select another ball and in turn reveal the next question. At the same time, the user would move to the next subsequent base when they answered the question correctly. That doesn't seem to be happening when you click the baseballs randomly. 

    • NedWhiteley's avatar
      NedWhiteley
      Community Member

      Hi Jennifer,

      This can be solved with two simple changes to each question layer.

      1. Select a layer and open the Layer Properties dialogue box and check the "Prevent user from clicking on the base layer" option:

      2. Add an additional trigger to hide the layer when the user clicks Correct:

       

      Now repeat this process for each of your question layers.

      What will happen now when the user selects a ball, is that the appropriate layer will open and the user will now be unable to click on the base layer (i.e. select another ball) until a Correct answer has been selected, at which point that question will close, returning the user to the base layer.

      Hope this is the result you are after, but if you have any further queries, just get back to me.

  • Ned, what can I say, you came through again and I appreciate it, THANK YOU. Secondly, I TOTALLY forgot about Slide Layer Properties (shakes head in shame).  Perfect solution. 

    • NedWhiteley's avatar
      NedWhiteley
      Community Member

      Hi Jennifer,

      No problem, happy to help and if you have any more problems, just give me a shout.