Hey Scratch makers, (people who helped program the scratch blocks) how did you program a block that we use for other programming? becuase heres my question:
you have to program the block to do stuff right? so id be like this
<move( )steps>
To program that block id say somehting. what does it say?
Offline
Heybrian wrote:
Hey Scratch makers, (people who helped program the scratch blocks) how did you program a block that we use for other programming? becuase heres my question:
you have to program the block to do stuff right? so id be like this
<move( )steps>
To program that block id say somehting. what does it say?
That one isn't too hard to make and I made a demo of how to make it with trig functions.
and the code is,
change x by sin of direction
change y by cos of direction
This will make a sprite move 1 unit.
The distance to block was created using the Pythagorean theorem.
In this example I will find the distance between spriteA and spriteB
distance= square root of ( (x position of spriteA - x position of spriteB)^2 + (y position of spriteA - y position of spriteB)^2)
And the point to block was probably made using the atan2 math function
I will make spriteA point to spriteB
angle = Math.atan2( -(y of spriteA - y of spriteB),(y of spriteA - y of spriteB))
rotation = 270-angle
Thats the way I would program things.
Last edited by archmage (2008-01-27 23:20:57)
Offline
but the thing is, you have to program what those say right? and are they bricks too?
Offline
No, I am pretty sure the blocks are programmed in the squeak language.
I mentioned some of the ways that could be used to program some of the blocks in my above post. The programming I mentioned could also be applied to blocks (except point to because it requires atan2).
Last edited by archmage (2008-01-27 23:47:51)
Offline
so what the heck is that?ive heard of it. i think you like make blocks? i saw it in this "flip" project.
Offline
Squeak is the language that scratch was programmed in. If you know squeak you could program your own blocks in the open source version of scratch.
Offline
ooohhhhh. ...... so scratch is just an easier method of programming?
Offline
Scratch was meant to be a simple language that anyone could easily pick up. It is easy to learn but you can use it to make complex programs if you wanted.
Offline
Yeah, i think blocks like move()steps are way easier then that sin and cos stuff you were talking about!
Offline
In other languages you have to ype the commands - every mistake is a bug. Scratch is a "new" way of programming - you drag blocks together instead of typing code.
an example:
this is (easy!) flash action script code:
sprite1.onRelease = function() {
for (i=0; i<360; i++) {
this.direction = this.direction + 1
}
}This is (almost) the same thing, but in scratch:
code wrote:
---
[blocks]
<when[ sprite 1 ]clicked>
<repeat( 360
<turn cw( 1 )degrees>
<end>
[/blocks]
---
What do you think is the most easyest?
Offline
how do you get the open source version of scratch?
Offline
to jso, I THINK SCRATCH IS EASEIR LOL! that looks so hard! to blob, its called squeak.
Offline