Discuss Scratch

ModokDad
New to Scratch
3 posts

How do different move commands interact?

I'm new! (Trying to figure this out to help my young daughters.)

In the starter Pong game

http://scratch.mit.edu/projects/10128515/#editor

(where else would I start?) there are two move commands within the scope of two forever operators (C-clamps? That's what they look like.) If bounce -> move 10 steps. If touches paddle -> move 10 steps. Clear enough. But I'm not quite sure how these two interact. Experimentally, I lowered the bounce-move to 1 step while leaving the paddle-move at 10. I thought the result would be that the ball would move very slowly until it first touched the paddle, then it would speed up to 10 and either remain at 10 throughout the game (since forever is forever!) or slow to 1 again when next touching the paddle. But it didn't do either. It jumped 10 once after touching the paddle but then reverted to the slow 1 speed, per the bounce rule.

I guess that makes sense. (I wasn't expecting it to keep making the bounce noise forever, so why should it make the bounce move forever?) But does this mean that bouncing-then-moving is syntactically different than touching-then-moving?

So that's question one: bouncing different than touching?

Next question:

How would I produce the result that I expected from my original experiment, but didn't get? Namely, getting the ball to speed up permanently after touching the paddle for the first time? I can put the move in the touch -> move comment within the scope of another forever command. That speeds it up permanently.

But now the game will never end because we never go down the fork that leads to the touch red -> stop.

I feel like I'm missing something.

Also, how do I upload pictures so I can show all this rather than describing it? Do I have to wait until I'm not a newbie anymore and then I get image privileges?

Thanks for your help.
ModokDad
New to Scratch
3 posts

How do different move commands interact?

Nevermind about the upload images question. I guess I have to use Photobucket or something of the sort. That's fine.

Also, one typo in my question. “touch -> move comment” should be ‘command’. (Probably you figured that out!) I guess editing my own forum post, for typos, is something I can't do (yet?) because I'm a newbie?

drmcw
Scratcher
1000+ posts

How do different move commands interact?

You can post pictures by using approved image sites like tinypic.com, or type in scratchblocks . The best is to link to the project as you have done. The example you're using is not the best example really as it would be better in one script. I suppose what it is showing is that you can have more than one script and both scripts will run at the same time. The game only does the paddle bounce when it touches the paddle so most of the movement is due to the move in the if on edge bounce loop. To get the ball tp change speed you would need to use a variable and replace both move values with the variable. You can then increase the value in the variable to increase the speed. The loop with the if on edge bounce is the loop which give the ball most of its movement the if on edge bounce block is just added in so that if the ball is on the edge it will bounce off the screen edge, it doesn't run just when the ball is on the edge.

Last edited by drmcw (Oct. 22, 2013 06:57:54)


10 !
ScratchVaders or Galaga?
Maybe Eliza can help you decide?
ModokDad
New to Scratch
3 posts

How do different move commands interact?

Thanks. I see that my error was interpreting the IF ON EDGE -> BOUNCE block as an if-then statement that took the MOVE 10 block as its consequent. That didn't make any sense, as there would then be no way to move initially. And now I see that I can simply reverse the BOUNCE and MOVE command order. I see also that FOREVER (if touching -> move 10) is not equivalent to (If touching -> move 10 FOREVER).

Powered by DjangoBB