Scratch 3 block help (Part 1)

Hi @sairam,
But I don't understand... You requested for Scratch3 blocks, but you are pointing to a future (or not) feature that I think is not implemented in Scratch3 (nor 2).

My thoughts are... Our stage is really a "motionless object" (the same as the rest of other sprites, but we don't move it). So, if you want a "moving background" you must use an Sprite. And you can build the scrolling effect easilyi ( @bloct examples show it).

Respect Brian's comments, Yes I need more than one sprite to achieve a wrap effect if the picture is only a the single image (to wrap it). I think it's more easy to build a larger image (copying half of the stage size aside every wrapping side) and then we can manage the "wrap" effect easily, setting this single sprite position. Something like...
scrolling

Joan

so, we do have a bunch the Scratch features that folks want in Snap!, and then some. For example, we have a "pitch effect" for sounds, but it's in the audio comp library and it lets you tweak the playback of sounds by changing the sampling rate. We're using this all the time in demos where we record a sound and turn that single sound sample into a song. For example at a recent talk I gave in Klagenfurt I recorded a single chord on my ukulele and then tweaked the playback sample rate to turn it into the infamous "smoke on the water" riff. Also, last Spring in Spain we took the recording of a word like "Snap!" and turned it into Beethoven's "Für Elise" and then into "Bi- Ba- Butzemann".

In the new version of Snap5 we have more support for scrolling and layering, and there are some cool examples. Have you seen the parallax scrolling example https://cloud.snap.berkeley.edu/site/project?user=youngthinkers&project=Parallax%20Cloning or the Santa Sim one https://cloud.snap.berkeley.edu/site/project?user=jens&project=SantaSim?

@bh these LOGO modes that you and Gary keep talking about turn out to be way harder to - not just implement - but design than you'd think. "Fencing" could be done fairly easily, but I'm almost 100% sure that it's not what folks really want. The benefit of "fencing" is that we don't have to begin showing novices how to reset sprites to a visible position, but for the kind of kids that want to do "scrollers" fencing doesn't help.

"Wrapping" has little to no benefit unless you're using the pen to draw things that rely on wrapping. Even if you do that those patterns would be dependent on the stage's aspect ratio more than on anything else, so I'm not really convinced there's any intellectual gain from doing it. Where "wrapping" could be - mildly - interesting would be for sprites with a costume to reappear at the geometric opposite side of the stage. But, and that's a fairly big BUT: Since in Snap a sprite does encompass a potentially large area the same sprite would have to appear in - at least! - two locations whenever it starts wrapping, potentially in more, if it wraps near a corner of the stage. THAT part, when a sprite partially leaves the stage AND at the same partially reappears in one-to-n opposites is not solvable in ways that users would either understand or appreciate, I'm sure. It would also require changing our GUI paradigm in ways that create more uncertainties and questions. For example, in a partially mirrored multi-locational sprite what's the top / bottom / left / right hand sides, center etc., also, while a sprite is multi-locational can it simultaneously collide with multiple other sprites that are farther away from each other than the fractured sprite's total area, or what does it even mean when you make a sprite "go to" the mouse pointer or another sprite, but at that target it already starts wrapping and thus also appears at other sprite's locations, or - as it turns out - not at the mouse pointer's location at all but somewhere completely different with no apparent relationship to the actual mouse pointer's position?)

Now, please don't see these questions as a challenge to offer a set of rules trying to second guess what the user might sensibly mean or want in each situation. My point is, the people who clamor for "wrapping" (yes, especially Gary, who claims we "killed" LOGO by omitting it) didn't even think about what it means for a sprite-based microworld. All they see is turtles, but that's not all there is in Snap.

So, back to wrapping of background: Yes, it's complicated, I'm curious about what you're going to invent! :slight_smile:

@jens Yeah, hard to implement. It took me forever in Berkeley Logo to get the right thing to happen when the turtle exactly hit a corner of the stage.

But it's not about drawing pictures, for which you almost always want window mode (which we have now). It's precisely about multiple sprites! For example, one of the standard demos in Sprite Logo was to give a bunch of sprites a plain old filled circle as a costume, then have them all start at the center but facing (equally spaced) different directions, then just FOREVER [FD 1]. Because of the symmetries involved, it kind of looked as if they were bouncing off the edges.

Anyway, this is an interesting conversation for later. :slight_smile:

How do I create the {go [forward v] (1) layer} because i made it like this but it doesn't work.
So,.....

Give me the full code please. Because I am a n00b in js.

Hi @sairam,

But you don't need more JS code!!

I shared that code ("layer" and "layers" reporters) because with them and the Snap! primitives ("go to front" and "go back ( ) layers") you can build everything you need.

That noJS code could be:
goForwardLayers

and also you could build
goToLayerNum

Thanks a lot guys.
And the last question how to apply library that to be added in the import libraries?

And another thing is that how to make <[message 1 v] received?> block?

Hi @sairam,
Trying to answer some of the questions...

  • If you have some collections of custom blocks, you can export them (Export blocks option). You will get an xml file with these blocks. And you can import them wherever you want (importing will upload these blocks without restarting your project).
  • To help your students, you can also store empty projects with these blocks (and maybe you can add some other customization: hide some primitives, add some comments into the scripting area...). Sharing these projects, you will get a simple URL for your students, and they will get quickly the starting point you are proposing.
  • You can also suggest (in this forum) adding a library to the official repo. But this is a design decision... and it will be only a request to be valued.

And sorry, I don't understand what do you mean with " <[message 1 v] received?>". I don't see this block anywhere.

Joan

Oops!

I see (and answer) the last question (about "message receiving") on other thread!

Please, help us to put order in discussions and not repeat questions in different places.

Continue...
Joan

I did the that fully but any message received is my problem. So please help on this.
Or create a js code for this.???

init
when
pred
When you're finished processing a message you'll want to remove it from the list.

But you could make 5 blocks and use that.

You could try my code.
My code is that the
If (message) = (message) or (message) = [any thing] then
Report true
Else
Report false

Oh @sairam1235,

But this is not the same. If you only want if the current message is not empty... You only need
messageReceived

Joan

No this code reports false
If (message) = [any message] then
Report true
Else
Report false

I used the special menu message menu.

can you explain?

I don't understand what you want.

Yes this predicate reports false when no message was received, and true when "any message" was broadcasted.

The issue is that the MESSAGE reporter reports the most recent broadcast message. If two different messages happen in quick succession you might miss one of them. That's why, if you're really serious about not losing a message, you have to keep a list of them.

The special menu of message consists of any message and other messages.
But when I use any message option
It reports false but it should report true.