This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-08-30 00:17:55

jwiens
Scratcher
Registered: 2007-10-17
Posts: 39

Calculator MathHelp

Well, I am making an OS and it has a calculator application. I have two sprites for the answer and they switch to a certain costume depending on the answer. The problem is that I have tried to make the ones digit change to a certain costume based on the ones value. eg answer 81 sprite of ones 1. My formula was

set answer ones to round answer/10 -.5

this doesn't work because scratch round things to the nearnest tenth so what I am trying to do doesn't work. Any suggestions?

Offline

 

#2 2008-08-30 00:50:03

dingdong
Scratcher
Registered: 2007-08-09
Posts: 1000+

Re: Calculator MathHelp

umm... it rounds to the a whole number for me... dunno


http://img851.imageshack.us/img851/2829/superanbanner.png
click the image for my music

Offline

 

#3 2008-08-30 01:23:44

catowner
Scratcher
Registered: 2008-06-30
Posts: 51

Re: Calculator MathHelp

if answer over 10 is less than 1 set costume of sprite1 to costume10 and costume of sprite2 to answer. costume 10 will be zero and all other costumes will be the same as their number.if not, do the following if answer over 10 rounded is less than answer over 10, set sprite1 costume to answer/10 rounded. if answer over 10 rounded is greater than answer over 10 set sprite1 costume to answer over 10 rounded -1.if answer-10x the costume number of sprite1=0, switch to costume 10. if not, do the following: set sprite2 costume to answer minus 10 times costume number of sprite 1.


there are 3 kinds of people: those who are good at math and those who are good at speling.

Offline

 

#4 2008-08-30 05:32:19

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Calculator MathHelp

Try using the MOD function from the numbers area.  It returns the remainder of a division.  For example:

             81 MOD 10  = 1
             97 MOD 10  = 7


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#5 2008-08-30 15:28:58

jwiens
Scratcher
Registered: 2007-10-17
Posts: 39

Re: Calculator MathHelp

thanks paddle2see

Offline

 

Board footer