Discuss Scratch

lilsneaks1
New to Scratch
5 posts

Repost: Need Help Finishing My Math Game!

Here's my problem, I need to make it so there are no negative numbers or any non-whole numbers at the answers in my game. My game is working as intended so far but I can't figure out how to stop the game from making the answer negative or a fraction (i.e: 1-9=-8 or 4/8=.5).

I've already got some help and implemented the advice but I can't get it to work properly for division problems. I've got subtraction working though. Here's the link: https://scratch.mit.edu/projects/287542937/
mstone326
Scratcher
1000+ posts

Repost: Need Help Finishing My Math Game!

Work the division backwards for now. Multiply two numbers to get the product. Set the dividend to the product. Set the divisor to one of the numbers you used to multiply earlier. Then set the quotient to the other you multiplied. There are better ways but for now, working backwards should help.

num1 = some number
num2 = some number
product = num1 * num2

dividend = product
divisor = num1
quotient = num2

Last edited by mstone326 (Feb. 19, 2019 00:49:43)


High School Athletic Director / Middle School Tech Teacher / High School Baseball Coach
Kung Fu by Nintendo 1984 - https://scratch.mit.edu/projects/369994801/
Taco Defense - Speed Typing - https://scratch.mit.edu/projects/316795450/
Halloween Boss Battle - Taking Back our Woods - https://scratch.mit.edu/projects/257155118/
Almost Pong - https://scratch.mit.edu/projects/656276979/
Studio - My Best Projects - https://scratch.mit.edu/studios/4125978/
Forum Help Project Examples - https://scratch.mit.edu/studios/4133335
gor-dee
Scratcher
1000+ posts

Repost: Need Help Finishing My Math Game!

You have the Ask script inside the ELSE, it should be inside the IF.
Having said that, it still won't work as it is. Deck had the right idea, get rid of the repeat loop around SET value 1 and SET value 2 and add
set [ value1 v] to ((value1) * (value2))
so you set value1 to say 5
then set value2 to say 7
then you set value1 to value1 * value2 = 5 * 7 = 35
then you ask what is value1 / value2 = 35 / 7 = 5
drchubbington
Scratcher
100+ posts

Repost: Need Help Finishing My Math Game!

An efficient way to check if a number is negative or a fraction:
if <not <((Number) / ([abs v] of (round (number)))) = [1]>>then

end

when green flag clicked
forever
Be awesome!
end
lilsneaks1
New to Scratch
5 posts

Repost: Need Help Finishing My Math Game!

I would like to thank all of you for the help. My game is finished and it's thanks to you guys. Here's the link if you want to check it out: https://scratch.mit.edu/projects/287542937/

If you have any critiques feel free to tell me about them.

Powered by DjangoBB