Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » What can i use for "any multiple of" as coding in scratch?
- Nexus_uno
-
3 posts
What can i use for "any multiple of" as coding in scratch?
I have a glitch that only happens on the multiple of a specific number but it stops glitching when i set an if the variable equals the number or a multiple of the number it fixes, but i don't want to type it out for each equation so I looked for something to represent that and could not find it.
- drmcw
-
1000+ posts
What can i use for "any multiple of" as coding in scratch?
So number mod 2 = 0 when number is even.
- Nexus_uno
-
3 posts
What can i use for "any multiple of" as coding in scratch?
So number mod 2 = 0 when number is even.
I'm not understanding; my program is here -> http://scratch.mit.edu/projects/41873706/#editor
a note is written in the stage at the problematic point.
Last edited by Nexus_uno (Jan. 16, 2015 08:19:08)
- ShadowScizor
-
100+ posts
What can i use for "any multiple of" as coding in scratch?
takes the remainder of the division
For example:
equals to 1
as 5/2 will give a remainder of 1.
Hence if the second number is the multiple of the first number, the result will be 0.
eg.
equals 0
- TheLogFather
-
1000+ posts
What can i use for "any multiple of" as coding in scratch?
The quickest way to fix it is to get rid of that script at the top left of Stage which is checking abs(round(ScrollX)) all the time, and use round((ScrollX-1)/480) in the script below (i.e. subtract 1 from ScrollX).
That makes enough of a difference at the critical halfway point to get the Platforms calculations to work out in the way you want.
That makes enough of a difference at the critical halfway point to get the Platforms calculations to work out in the way you want.
- Nexus_uno
-
3 posts
What can i use for "any multiple of" as coding in scratch?
Thank you. From what i can tell this fix worked perfectly. The quickest way to fix it is to get rid of that script at the top left of Stage which is checking abs(round(ScrollX)) all the time, and use round((ScrollX-1)/480) in the script below (i.e. subtract 1 from ScrollX).
That makes enough of a difference at the critical halfway point to get the Platforms calculations to work out in the way you want.
- garrythepotato11
-
2 posts
What can i use for "any multiple of" as coding in scratch?
so if it is the number is 20 what would the mod be
- duckboycool
-
1000+ posts
What can i use for "any multiple of" as coding in scratch?
Please check the date of the topic before posting. so if it is the number is 20 what would the mod be
Nothing as mod requires two inputs. This is how it works.
- asivi
-
1000+ posts
What can i use for "any multiple of" as coding in scratch?
so if it is the number is 20 what would the mod be
You question makes no sense, if you want to know if a number is a multiple of another, let say, Is 24 multiple of 3?
Please check the date of the topic before posting. so if it is the number is 20 what would the mod be
Nothing as mod requires two inputs. This is how it works.
- Harakou
-
1000+ posts
What can i use for "any multiple of" as coding in scratch?
Thanks. Here's the Scratch wiki article on the mod block, with a bunch of examples on how to use this. I'll close this thread since OP's question seems to be resolved. @garrythepotato11, if you have further questions you should make your own thread. Thanks!Please check the date of the topic before posting. so if it is the number is 20 what would the mod be
Nothing as mod requires two inputs. This is how it works.
- Discussion Forums
- » Help with Scripts
-
» What can i use for "any multiple of" as coding in scratch?