hi i am new to scratch have been using it for a few hours and getting the hang on it. interacting with other sprites, moving sprites with arrow keys.
for a project i need to include ' use at least one condition, one loop, and one variable '
i have done the variable which is using the arrow keys, change x by -25. but what does it mean to loop or the definition of a condition.
i would take a guess and say using the REPEAT UNTIL function is a condition?
finally in conversing with sprites how do you stop the speech bubble appearing in one of them as when sprite 1 touches sprite 2, sprite 2 starts talking but sprite 1s speech bubble is still present, ive tried attaching stop script but that has not worked
when gf clicked if [touching sprite 2] stop script endany suggestions?
Offline
A condition refers to an "if" clause. The code inside the bracket is executed if the condition is true. For example:
when gf clicked set [RandomNumber v] to (pick random (1) to (100)) repeat until <(answer) = (RandomNumber)> ask [Guess my number!] and wait if <(answer) > (RandomNumber)> say [Too high!] else say [Too low!] end end say [You got it!]This code uses a variable, a loop, and a condition.
Last edited by amcerbu (2013-01-11 16:29:49)
Offline
A loop is a section of the script that repeats, sometimes as long as a condition is true. The Scratch blocks that allow you to create loops are:
forever end
repeat (10) end
forever if <condition> end
repeat until <condition> endThe blocks that allow you to check for a condition (without looping, unlike "forever if" and "repeat until") are:
if <condition> end
if <condition> else end
wait until <condition>And as for the last question, you can hide a sprite's speech bubble by using a say block with nothing in it:
say []As for the last question, the "if" block checks for a condition when it's ran (that is, when you click the green flag), and then never again unless you run it again. Thus, it's best if you use the "wait until" block in this situation.
Offline
technoguyx wrote:
And as for the last question, you can hide a sprite's speech bubble by using a say block with nothing in it:
say []As for the last question, the "if" block checks for a condition when it's ran (that is, when you click the green flag), and then never again unless you run it again. Thus, it's best if you use the "wait until" block in this situation.
Hey thanks alot didn't expect such a detailed reply its starting to make a lot of sense now . Looking back at my original question now i feel that ive learnt so much already as for the hiding a sprite's speech bubble i used this instead, it works too.
say [bye] for (2) secsthanks a bunch dude cant wait to try more complicated stuff
Offline