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
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
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
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
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.)
Offline
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
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.
Offline
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)
Offline
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)
Offline
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.
Offline