Paste a Sprite on another Sprite

Could you post a link to an example of what your trying to do?

It may be possible to speed it up using a hyperblocks approach

Ok. Here is the example: https://snap.berkeley.edu/snap/snap.html#present:Username=pavelbel&ProjectName=holes%20demo
Click the green flag and then click anywhere on the brick wall. You will see holes appearing in it. You can even see background throught them. I do it by manual editing of brick wall's pixels - setting some of them to be transparent.

I don't know why i had to do snap forks, I guess just to try it out..

I couldn't come up with a hyperblocks method but modified a project from the recent Snap! course to give a low code similar effect

image

Brilliant idea of using background image clipped by sprite used as mask :wink:
It can be further simplified to stamping without clones.
BTW: there is no need to show sprite before stamping/pasting.Trans script pic

The paste on block doesn't seem to be affected by the color graphic effect.

@jens?

Yes, that's right. paste disregards graphic effects both on the pasted and the pasted-on sprite. it does take into consideration (relative) size, position and rotation, which lets you do all kinds of interesting effects yourself. And you can also paste a sprite onto all clones of another sprite simply by choosing the original's name. That way you can create a multi-part jigsaw-puzzle or a swarm-picture in a single pass. Example:

Oh, embedding projects is disabled right now, here's the link: https://snap.berkeley.edu/snap/snap.html#present:Username=jens&ProjectName=SAP%20Flag&editMode

Oh yes, that's a good idea for making visual "holes", thank you! But it wasn't my real goal :slight_smile: It was just a part of a more complex task. Here is another example:


Move mouse to aim, press SPACE to fire. You see here: cannonballs damage the terrain. I have a terrain sprite and a "sky" sprite to paste on the terrain to emulate shell craters, similarily to what you do. Now I use "touching color" sensor to detect when and where a cannonball hits the terrain. This approach has two problems:
  1. I want the terrain to have a texture. But now it must be of one solid color to use "touching color" sensor correctly. It also implies that the background picture should not have this color on it.
  2. "touching color" sensor is quite slow.

That's why I'm looking forward to use "touching sprite" instead, because it solves both issues. And that's why I try to make some parts of the terrain sprite really transparent - so that "touching sprite (= terrain)" sensor can return "false" when a cannonball is over these transparent parts.

So I end up manually altering (i.e. setting the alpha value to zero of) terrain's pixels near the impact point, and it's quite slow. It would be great to do this with some kind of "paste on" blocks. Is it possible, @jens?

OMG, this project is awesome! Would you mind publishing it so I can feature it?

maybe you could try pasting another sprite whose costume is almost-fully-transparent on it, with a very low alpha value? Oh, wait, no. Pasting only adds, never subtracts.
Let me think about this...

Oh... For me it's just a draft to put the basic mechanics right... But if you think it's worth featuring, I won't mind.

What about?...
paste effects
or even
PasteOnWithEffects script pic (1)

see, that's the problem with every feature that I put in. I'm putting a ton of effort into selecting the one setting that will open up the most broad range or activities. And then people want drop-down menus, buttons and settings. And THEN everything turns into Microsoft Office and becomes unusable.

Now, let's find a smart way, or not do it altogether.

Yeah, you've opened the Pandora's box when introduced pasting of one sprite onto another :slight_smile: It opened a totally new approach to sprites handling and graphic effects, a new degree of freedom, that's why we need more :slight_smile:

You can check to see if touching one of the the looking glass clones - reload my project and use extra sprite to test this with

image

Yes, I've thought about that too. But there will be a problem if the terrain sprite is not simply a rectangle but initially has transparent parts (like in my "cannons" project). So we'll need a "background" sprite too that wil be partly visible from the beginning. Thus we'll have to use complex condition to detect terrain impacts: cannonball NOT ("touching lookinglass" OR "touching background"), but this will cause errors in areas initially occupied by terrain sprite and background sprites: impacts in these areas won't be detected because "touching background" will be true there. Hope my explanation is clear.

Yes :slight_smile:

Unfortunately, its my lack of understanding of your native language makes its very tricky for me to play with your projects and modify them as I don't understand the variable and sprite names

Ok, I should have thought about that :slight_smile:
Translated both projects to english.
Thank you for your efforts! :slight_smile:

What about this?

Click anywhere on the ground to punch a hole.

It's not instant, but maybe it's fast enough for your project...