View Single Post
Junior Member
Status: Offline
Posts: 10
Join Date: Apr 2015
Unhappy 05-09-2015, 07:47 PM

I tried doing the poses, but the player isn't moving the respective places. Attached is what I have done so far.

Originally Posted by chickentree View Post
There are two ways I've found that will do what you want. By far the easiest is using poses the work is all "up front" i.e. done in the design not during execution but it works.
  1. Select the spinner and in the properties panel (Lower left of Alice) click on "Create Pose" use "initialPose" for the name.
  2. Repeat the step above but use "onePose" for the name (I am assuming the spinner is initially pointing at one.)
  3. I'm assuming you are using the spinner with 20 divisions. So movement between the segments is 1/20th of a rotation, or 0.05 revolutions.
  4. In the Alice IDE right click on the spinner's Arrow ( the whole arrow not just the head.) Then select Methods-Turn-Left and enter 0.05 for the amount.
  5. Now select the whole spinner.
  6. In the "Properties" tab at the left, click the "Capture Pose" button and give the pose a name. I used the name of the segment and added "Pose" on the end. As in "twoPose", this will help you if you end up using the section name in your program.
  7. Repeat steps 3 through 6 until you have a pose for each spinner position.

To simplify things further you can create an array variable containing the poses but remember the array indexes start at 0 so if you wanted the spinner to go to 6 you would use an index of 5, or more generally index = spinValue-1.

The only problem I have found with this approach is that in going from one pose to another the spinner will take the shortest path, sometimes turing right and other times turning left. To get around this you could identify cases where the spinner would go the wrong way and take two steps to get to the desired value. The first would be a segment between the initial and final values in the direction you want the Arrow to turn. This would ensure the Arrow travels in the right direction.

Attached Files
File Type: a2w test.a2w (1.03 MB, 7 views)
Reply With Quote