This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-26 10:52:13

barndawg
Scratcher
Registered: 2012-03-08
Posts: 81

Repeating and correcting codes automaticaly

I really hate it when I find that I keep repeating code. When there is a problem with it, I have to change all the pieces of code. In scratch 1.5 I'd like a way round this. (Is there already one?)


I... need... Scratch 0.1! Find the forum at http://scratch.mit.edu/forums/viewtopic.php?id=113354
http://www.danasoft.com/sig/ScratchforumBarndawg.jpg

Offline

 

#2 2012-04-26 11:05:51

veggieman001
Scratcher
Registered: 2010-02-20
Posts: 1000+

Re: Repeating and correcting codes automaticaly

In Scratch 2.0, the next version, you'll be able to create blocks and then you'll just be able to change the code for the block as opposed to everywhere.


Posts: 20000 - Show all posts

Offline

 

#3 2012-04-26 11:30:36

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Repeating and correcting codes automaticaly

Meanwhile, it is a good idea to use broadcasts for more complicated functions that need to be repeated multiple times. Here is an example of what i mean using simpler blocks:

when gf clicked // main script
move (10) steps
broadcast [flip v] and wait
say [hey!] for (2) secs
broadcast [flip v] and wait
next costume
broadcast [flip v] and wait

when i receive [flip v]// this is the function that needs to be repeated
repeat (36)
turn cw (10) degrees
end
And then, if you need to change the speed of the flip or decide that you'd rather jump instead of flipping, you only need to change it once (in the second script)!

Last edited by LS97 (2012-04-26 11:31:07)

Offline

 

Board footer