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

#1 2009-01-04 16:41:36

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

A follow up on a post.

ScipioBellorum wrote:

Many of the blocks already available can be made using longer scripts...

Here is a huge list of examples

move ( # ) steps

set x to ( ( ( x position ) + ( sin of ( direction ) ) ) / ( 1 / ( # ) ) )
set y to ( ( ( y position ) + ( cos of ( direction ) ) ) / ( 1 / ( # ) ) )
_____

turn right/left ( # ) degrees

point in direction ( ( direction ) +/- ( # ) )
_____

change x/y by ( # )

set x/y to ( ( x/y position ) + ( # ) )

_____

next costume

switch to costume ( ( costume # ) + 1 )
_____

forever

repeat until ( 0 = 1 )
_____

forever if ( a )

repeat until ( 0 = 1 )
-----if ( a )
_____

( ) of ( sprite )
Use variables
_____

( a ) - ( b )

( ( a ) + ( ( -1 ) * ( b ) ) )
_____

( a ) * ( b )

( ( a ) / ( 1 / ( b ) )

Last edited by bhz (2009-07-14 06:59:20)

Offline

 

#2 2009-01-04 16:52:34

big-bang
Scratcher
Registered: 2008-02-21
Posts: 1000+

Re: A follow up on a post.

Wow... here's another one.
[blocks]<if on edge, bounce>[/blocks]
CAN BE REPLACED BY
<if><touching[ edge
<point in direction( (( <direction> <-> 180 ))
<end>[/blocks]


http://i47.tinypic.com/6edrbm.jpghttp://i45.tinypic.com/dw9hmw.jpghttp://i50.tinypic.com/f28tvn.jpghttp://i45.tinypic.com/ruwaop.jpg

Offline

 

#3 2009-01-05 06:54:45

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: A follow up on a post.

big-bang wrote:

Wow... here's another one.
[blocks]<if on edge, bounce>[/blocks]
CAN BE REPLACED BY
<if><touching[ edge
<point in direction( (( 180 <-> <direction> ))
<end>[/blocks]

correction. See quote  smile

n fact, your script only works when bouncing off the top and bottom walls.

Last edited by bhz (2009-01-05 06:56:36)

Offline

 

#4 2009-01-05 08:18:30

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: A follow up on a post.

and if i got it right
Point in direction direction * -1 is left and right, so using a if statement to cheak which wall your touching bouncing is also possible, however this is made for beginers so the codes will stay.

Offline

 

#5 2009-01-05 18:40:53

hmnwilson
Scratcher
Registered: 2007-07-04
Posts: 1000+

Re: A follow up on a post.

There's lots of blocks you can use a longer method to make, but having the single blocks makes life a whole lot easier. (Plus they save a little bit of room.)


I'm taking a break from Scratch until 2.0 comes out. Any messages sent between then and now probably won't be read - sorry.
(Oct. 20, 2011)

Offline

 

#6 2009-01-06 06:55:40

bhz
Scratcher
Registered: 2008-07-06
Posts: 100+

Re: A follow up on a post.

yambanshee wrote:

and if i got it right
Point in direction direction * -1 is left and right, so using a if statement to cheak which wall your touching bouncing is also possible, however this is made for beginers so the codes will stay.

direction*-1 is also up and down.

Offline

 

#7 2009-01-06 15:43:06

boinoinoi
Scratcher
Registered: 2007-06-05
Posts: 500+

Re: A follow up on a post.

bhz wrote:

yambanshee wrote:

and if i got it right
Point in direction direction * -1 is left and right, so using a if statement to cheak which wall your touching bouncing is also possible, however this is made for beginers so the codes will stay.

direction*-1 is also up and down.

...Except it only works if you start with down.


http://i30.tinypic.com/335fpxx.jpg
"Boinoinoi is the only person on the forums that I expect to be wearing a monocle all the time behind that screen, so I'm sure being as classy as he is, he knows what he's doing"        http://myfastcounter.com/count.php?c_style=88&amp;id=1284259111http://myfastcounter.com/count.php?c_style=88&amp;id=1286068127

Offline

 

#8 2009-01-06 16:08:34

techy
Scratcher
Registered: 2008-12-17
Posts: 100+

Re: A follow up on a post.

big-bang wrote:

Wow... here's another one.
[blocks]<if on edge, bounce>[/blocks]
CAN BE REPLACED BY

<if><touching[ edge
<point in direction( (( <direction> <-> 180 ))
<end>[/blocks]

here this works better


<if><touching[ edge
<point in direction( (( <direction> <-> 90 ))
<wait( 0.5 )secs>
<end>

Last edited by techy (2009-01-06 16:09:27)


Guppy Inc. making projects famous!
http://web-geeks.com/techy.gifhttp://web-geeks.com/grid.gifhttp://web-geeks.com/challenge.gif

Offline

 

#9 2009-01-06 17:12:16

boinoinoi
Scratcher
Registered: 2007-06-05
Posts: 500+

Re: A follow up on a post.

techy wrote:

big-bang wrote:

Wow... here's another one.
[blocks]<if on edge, bounce>[/blocks]
CAN BE REPLACED BY

<if><touching[ edge
<point in direction( (( <direction> <-> 180 ))
<end>[/blocks]

here this works better


<if><touching[ edge
<point in direction( (( <direction> <-> 90 ))
<wait( 0.5 )secs>
<end>
[/blocks]

instead of
wait ( 0.5 ) secs,
it'd be better to just have
wait until < not < touching [ edge ] ? > >

Last edited by boinoinoi (2009-01-06 17:12:59)


http://i30.tinypic.com/335fpxx.jpg
"Boinoinoi is the only person on the forums that I expect to be wearing a monocle all the time behind that screen, so I'm sure being as classy as he is, he knows what he's doing"        http://myfastcounter.com/count.php?c_style=88&amp;id=1284259111http://myfastcounter.com/count.php?c_style=88&amp;id=1286068127

Offline

 

#10 2009-01-06 19:18:37

ScipioBellorum
Scratcher
Registered: 2007-05-15
Posts: 94

Re: A follow up on a post.

hmnwilson wrote:

There's lots of blocks you can use a longer method to make, but having the single blocks makes life a whole lot easier. (Plus they save a little bit of room.)

That was my point when I made the original post, the whole idea behind Scratch is to make programming easier and more accessible, which is exactly what these kind of blocks do. That's not to say I want a million more repetitive blocks (I do feel the 'Forever if' block is a bit pointless), but often the methods are hard to work out - lots of people ask about testing whether a number is whole etc. The trick is to make the syntax accessible but not so oversimplified that there is the programming behind it becomes meaningless.

SB

PS. I was really amazed and quite chuffed to see one of my posts indirectly spawn a whole topic. I'm glad I was able to contribute.  smile


http://img393.imageshack.us/img393/339/logory8.png
                      The word processor for Scratch

Offline

 

Board footer