Discuss Scratch

Hyphenator
Scratcher
11 posts

More advanced type of scratch coding

Can someone help with more advanced type of coding please any tutorial would work
gor-dee
Scratcher
1000+ posts

More advanced type of scratch coding

That's fairly vague! A good thing to try though is using a tick broadcast. If you have a project with lots of forever loops try changing it to having just one
forever
broadcast [tick v] and wait
end
and having the other sprites code under
when I receive [ tick v]
instead of in forever loops
Hyphenator
Scratcher
11 posts

More advanced type of scratch coding

Ok thanks i will try that but like i need a tutorial for like all these blocks and what they mean like cos,sin,mod,sqrt and the rest
deck26
Scratcher
1000+ posts

More advanced type of scratch coding

Check the wiki pages and look up trigonometry on wikipedia. That should cover most of the options in that block.
nyankatpro
Scratcher
500+ posts

More advanced type of scratch coding

sqrt means square root, and it gives you the number you'd need to multiply by itself to get the number you input.
([sqrt v] of (9)) = 3
([sqrt v] of (16)) = 4
([sqrt v] of (64)) = 8
sin, cos, and tan are a bit more complicated, and chances are you won't learn about them in math until middle/high school. If you've ever played around with a graphing calculator, you'll know that putting in sin or cos will make a squiggly line, which you can use to make cool floating animations like this!
set y to ((((the height of the animation)*([sin v] of ((timer)*(how fast  it should go))))+(the y pos you want to start at)))
hopefully that wasn't confusing, trigonometry is hard to explain
edit: having trouble getting the script to fit on the screen, hopefully you can see it all

Last edited by nyankatpro (Dec. 13, 2019 14:01:56)

Hyphenator
Scratcher
11 posts

More advanced type of scratch coding

Ok thanks you guys
Hyphenator
Scratcher
11 posts

More advanced type of scratch coding

Also how can i do physics
imfh
Scratcher
1000+ posts

More advanced type of scratch coding

Hyphenator wrote:

Also how can i do physics
Here's a platformer tutorial by @griffpatch_tutor which has some basic physics: https://scratch.mit.edu/projects/67727504/
Hyphenator
Scratcher
11 posts

More advanced type of scratch coding

Thanks
Saprop
Scratcher
8 posts

More advanced type of scratch coding

how do you flip a variable both ways with the same code? (from negatives to positives and vise versa)
awesome-llama
Scratcher
1000+ posts

More advanced type of scratch coding

Saprop wrote:

how do you flip a variable both ways with the same code? (from negatives to positives and vise versa)
The two common methods are subtracting from 0 or multiplying by -1.

set [var v] to ((0) - (var))
or
set [var v] to ((var) * (-1))
Windcircuit
Scratcher
100+ posts

More advanced type of scratch coding

Hyphenator wrote:

Ok thanks i will try that but like i need a tutorial for like all these blocks and what they mean like cos,sin,mod,sqrt and the rest
Those blocks are for complex mathematical procedures that you will learn in older grades.
jmb1293634
Scratcher
1000+ posts

More advanced type of scratch coding

Windcircuit wrote:

Hyphenator wrote:

Ok thanks i will try that but like i need a tutorial for like all these blocks and what they mean like cos,sin,mod,sqrt and the rest
Those blocks are for complex mathematical procedures that you will learn in older grades.
sin and cos are hard to explain without pictures and I can't be bothered to make some mod is the remainder from a division so 5 mod 3 is 2 because there's 2 left over when you divide 5 by 3 sqrt is what number you need to times by itself to make it

Powered by DjangoBB