I want to make a multiplication game so I need the student to enter the answer . for example, if the student read in Co spaces 8*6= so he has to enter 48 and so on. so can you please tell me how to make variable in order to accept values from the student.
I want to do like this
accept the value from the student
if it is right say " excellent " else say " try again "
I am wondering if it is possible in cospaces.
Entering a number or text into an input field during the play mode is currently not possible. It’s a very interesting idea and something we’ll be looking into!
An alternative approach to your multiplication game can be done as a quiz. Below you can find an example plus code.
Show multiplication game example
How it works
For this game we create three functions. One to check the answer, and the other two to display a message if the answer is right or wrong. The
checkAnswer function has two parameters. The first,
panelValue, is the number that is displayed on the text item. The second,
correctValue, is the number you want to test the
panelValue against to see if it’s correct.
We place three
onActivate - blocks for each of the answer-texts. When one of the text items is clicked, we call the
checkAnswer function with the number of the text item and compare it to the solution.
checkAnswer function we use an if-statement to see if the panel value is the same as the correct value of the question, then display a message accordingly.
Code in action
Hope this helped!
It is great work and very helpful thank you very much
but unfortunately I don’t know how to create a function in blockly I tried to add input value but didn’t work also I don’t know how do you define the variables checkanswer , panelvalue , correctvalue did you define them or these build in the list of functions in the cospaces and you just use them .
here I understand that you give the values to panelvalue and correct value in order to compare them in the next blockly but I am not understand how do you define the variables correcrtanswer and the wronganswer in order to hold the result of the Comparison.
I understand how this works but I am not good in using functions so is there any user guide with the list of functions in cospaces and how to use them .
thank you Stefan for your help and really this opened my eyes to something wonderful in cospaces that I didn’t know about it before .
I hope that one day I will be very good in cospaces .
this is what I did before the same game but in different way
I will try to do it again using functions
The video below shows how you can make your own functions and how to use them
That is great , really I’m grateful to you , it was very helpful and I am happy that I can do that now .
and I will be thankful for you if you help me how to use the get item blockly , for example I tried to do something like on activate one item get another item but the blockly get item does not work with on activate blockly . so please tell me where to use the get item .
and be happy
make sure to give your item unique names when trying to get them with the “get” block. The block only returns the first item with a name that is found. If two items have the same name in the scene, it’ll pick the first of the two. Alternatively, you can also get the item by their unique ID which you can find in the item inspector.
Could you also share a link to the space you have problems with?