Unfortunately, the sharing permissions are not available on this link. You’ll need to update the sharing permissions in the class dashboard so we can see it. Sounds like a neat idea! Can’t wait to see it.
Thanks for sharing your code … a few observations for you.
Do you want 6 different sprites or just 1 sprite that can have 6 different faces?
If you create a sprite and set its animation to be one of the six animations to begin with, the question then becomes, how do I randomly change the animation to one of the other 5 animations?
Here is some pseudocode that may help.
Rename all of your animations in the animation tab with a number (1, 2, 3, 4, 5 & 6).
Create a variable at the top of your code … something like “face”.
When you click “g” change the value of the variable to = a random number between 1 & 6.
Set the animation to equal face. – This part is actually tricky though because your animation names (1-6) will be “strings” (text) and the variable will be a number.
Here’s a little block of code that will fix that. What it does is change the variable “face” (a number) into a string (text) so it can match the names of your animations by adding a blank character to the end of the number. This is one way in javascript to get a string from a number.
Have your student give it a shot and check back in if it still isn’t working quite right.
This looks great! You are only one small step away from it working. On line 6 of your code, the variable should be called “face”. Dice is your sprite and Face would be the number represented on the dice.
If you make that one change, I think it will work!