Discuss Scratch

gameteacher
New to Scratch
100+ posts

Can someone explain the coding here?

This is a Code Club project, found here:
https://codeclubprojects.org/en-GB/scratch/dodgeball/

Can someone explain the code for the rolling balls? The instructions tell you to now code the game so the balls roll through all the platforms. How would one do that?

Last edited by gameteacher (June 18, 2018 21:59:13)

VintageAura
Scratcher
100+ posts

Can someone explain the coding here?

https://codeclubprojects.org/en-GB/scratch/dodgeball/images/dodge-ball-motion.png

it's brutal and horrifying and you basically just say: move in this direction a bit, rotate a bit, repeat a couple hundred times, and all you do it trial and error

The Lobster mushroom, Hypomyces lactifluorum, contrary to its common name, is not a mushroom, but rather a parasitic ascomycete fungus that grows on certain species of mushrooms, turning them a reddish orange color that resembles the outer shell of a cooked lobster. H. lactifluorum specifically attacks members of the genera Lactarius and Lactifluus (milk-caps), and Russula (brittlegills), such as Russula brevipes and Lactifluus piperatus in North America. At maturity, H. lactifluorum thoroughly covers its host, rendering it unidentifiable. Lobster mushrooms are widely eaten and enjoyed fresh.They are commercially marketed and sometimes found in grocery stores; they have been made available at markets in Oregon. They have a seafood-like flavor and a firm, dense texture.
gameteacher
New to Scratch
100+ posts

Can someone explain the coding here?

Can anyone please explain?
mstone326
Scratcher
1000+ posts

Can someone explain the coding here?

I looked at the project directions. The balls follow as set path and do the same thing over and over until they complete their script and then they delete.

It appears to start in the top right of the screen and will follow the green line down to the blue line, repeating 22 times changing Y by -4. Once that repeat loop is completed, it will repeat moving on the x axis 170 times and rotate the ball as well. Once it completes that loop, it will repeat changing Y by -4 30 times. Then it will delete that clone.

The Green Flag script creates a clone every 3 seconds. Not sure exactly what you are looking for but that is a breakdown of each of the scripts in the clone script. It appears to be a very basic movement script for the balls.

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
gameteacher
New to Scratch
100+ posts

Can someone explain the coding here?

mstone326 wrote:

I looked at the project directions. The balls follow as set path and do the same thing over and over until they complete their script and then they delete.

It appears to start in the top right of the screen and will follow the green line down to the blue line, repeating 22 times changing Y by -4. Once that repeat loop is completed, it will repeat moving on the x axis 170 times and rotate the ball as well. Once it completes that loop, it will repeat changing Y by -4 30 times. Then it will delete that clone.

The Green Flag script creates a clone every 3 seconds. Not sure exactly what you are looking for but that is a breakdown of each of the scripts in the clone script. It appears to be a very basic movement script for the balls.
Thank you. So what would I need to do to complete the instructions, which ask one to create a script that would cause the balls to roll all the way through?
gameteacher
New to Scratch
100+ posts

Can someone explain the coding here?

What do the “repeats” do and why are they numbered differently? What do the negative numbers do and why do they change? Why is the turn 6 degrees exactly?
mstone326
Scratcher
1000+ posts

Can someone explain the coding here?

A repeat loop will repeat the block inside n times. For instance these 2 sets of scripts do the same thing, they both will end up moving 30 steps. You can multiply the repeat number by the change number for how far on the stage the ball will move.

move (10) steps
move (10) steps
move (10) steps

repeat (3)
move (10) steps
end

The negative numbers work the the x y axis. So moving right will change x by a positive number, moving left changes x by a negative number. Moving up changes Y by a positive number. Moving down changes Y by a negative number.

The turn 6 degrees will turn the ball at the rotation that the creator must have thought was appropriate for a roll. Turn it 2 degrees and it will go slow, turn it 100 and will go really fast.

I am not sure where you are in your project that you need to complete it. If you follow the directions completely it should do it all for you.

Look at the scripts they gave. The ball starts in the top right at x 160 y 160, then it repeats moving down. Then it repeats moving left, then down, then deletes.

If you don't know, the stage where the action happens is 480 pixels (steps) wide. -240 (left) , 0 (center), 240 (right).
360 height. 180 (top), 0 (center), -180 (bottom)

Edit:

Welcome to Scratch. If you click on the Tips menu there are a dozen tutorials that will help with your questions instead of jumping right into a complex project and copying scripts. Try working through those Tips, there are some good projects on there.

Last edited by mstone326 (June 19, 2018 02:12:30)


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
gameteacher
New to Scratch
100+ posts

Can someone explain the coding here?

Thanks! I think I got it now.
mstone326
Scratcher
1000+ posts

Can someone explain the coding here?

Good luck on your project!

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

Powered by DjangoBB