Snap! Sprite and Stage and Scene ideas!

I had some ideas to add to the sprites and stages in Snap!

Please give me feedback!

What is the use case for a programmatically generated scene? If you can fit all of its data in your project, there’s no need for a separate scene at all, I think. As for creating a sprite, ordinarily you’d just clone a sprite that already has those pieces (scripts, costumes, etc.) wrapped up together. But I’d be interested to see a use case that this would improve.

Is the use for a scene just to be able to fit more data?


to @redgeographysnap, the bottom two blocks can already be done.

For the second block, why would you be able to drag the stage inside (a stage isn’t a scene!)?

Or for people to collaborate on a project without editing the same project file at the same time.

But also, these blocks would require us to have both projects in the memory of a single Snap! instance at the same time, which we don’t currently do. Not that we couldn’t, but we’d have to have a really good reason. :slight_smile:

@bh You have a point. While it might be cool it wouldn’t have much practical use. :head_shaking_vertically:

@sathvikrias How? Like, I actually don’t know yet.

We can first start with creating a sprite, which can just be done with (a new clone of [[Turtle sprite] V])

To add costumes, it’s as simple as adding a costume to the (my [costumes V]) list. Same with sounds (selected costume is just making it switch to that costume). The position is also super easy.

Scripts is the more tricky part, and it’s only become possible (natively) with the latest update.

All you need to do to set scripts of a sprite, is to just do this

The reason I’m using the run block, is because I can’t put the ((my [scripts V]) @>) directly into the set [ V] to [] block directly, so I have to pass it in with the run ({} @>) with inputs [] @<:> block.

If you combine all of these together, you get this script.



Yeah, the green flag script didn’t get ran when the sprite was created,however that can easily be done by using broadcast[[__shout__go__] V] to [Sprite(2) V] @<> (you can put the output of the new sprite block into the second input in case you don’t want to do it by name).

Thank you!

Doesn’t the set () to () block support the relatively new scripts option?

Indeed it does!

Oh, I didn’t notice that, but passing in the block still works.

oh god… since when?

I’m hoping that the new update means that the extension function for loading XML will work all the time now, because setting “my scripts” doesn’t allow you to just add scripts without rearranging the palette or define where in the palette to put the newly loaded scripts (unlike the extension function).

I hope so. This would make some of the custom types projects work better, probably.

whoops.

I am sure you meant the “scripting area”. The palette is where you grab blocks from.


Also, metaprogramming doesn’t support comments well, so in most cases, the comments still exist but are invisible.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.