alice-teacher Number Variables - Integer Only?
Don Slater
dslater at andrew.cmu.edu
Fri Apr 8 08:13:05 EDT 2011
The simple answer is to use the "int 'a' as string" tile under Worlds: Functions: Advance Math tab.
I have attached three screen shots for a more complete answer.
1) Create a 3D text object (in my example I named this object "score"
2) Create a Number variable (in my example I named this variable "number"; I really have the creative juices flowing this morning ;-) )
3) "Step1.png" shows that I am using the " 'what' as a string " tile under Worlds: Functions: String tab as the argument to the " set text to " tile of the 3D object "score" property
- I select the Number variable "world.number" as the 'what'.
4) "Step2.png" shows that I am using the "int 'a' as string" tile under Worlds: Functions: Advance Math tab to replace 'world.number' in the " set text to " tile of the 3D object "scores"property
- Again, I select the Number variable "world.number" as the 'a'.
5) "Step3.png" shows the world after I run this small fragment.
I hope that this helps.
Please let me know if you have any other questions.
All the best,
Don Slater
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Step1.png
Type: image/png
Size: 56434 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110408/19a27eba/attachment-0003.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Step2.png
Type: image/png
Size: 71282 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110408/19a27eba/attachment-0004.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Step3.png
Type: image/png
Size: 50878 bytes
Desc: not available
Url : https://lists.andrew.cmu.edu/mailman/private/alice-teachers/attachments/20110408/19a27eba/attachment-0005.png
-------------- next part --------------
On Apr 8, 2011, at 1:29 AM, Michael Bauer wrote:
> Is there a way to specify that number variables store integers rather than real numbers. If you are using the textbook by Wanda, Steve & Randy, I am looking at the timer example in chapter ten. I want the time to display an integer, rather than a real number (eg., 10 instead of 10.0). I can get the text to display an integer initially with no problem. When the loop starts iterating and the variable gets incremented/decremented, then the passing the variable to the "set text to" method causes it to display a real number where I'd rather just see an integer.
>
> If you think of a scorekeeper rather than a timer, a game would increment a score everytime something is successful. I'd like the score to display without the decimal place.
> Thanks for your help!
> Mike Bauer.
> _______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers
More information about the alice-teachers
mailing list