"on edge" and "bounce" blocks

Here are the blocks

untitled script pic (4)
so you can create the block
untitled script pic (6)
as well other combinations.

Here is a variation of the "on edge" block

that also allows for

and you can still use as
untitled script pic (8)

I like the idea of reimplementing primitives to show how they work!

But I think your BOUNCE block is buggy, and not just because you left out the number at the top. You're right that sometimes 360-direction is the right thing and sometimes 180-direction is. But what makes the difference is not the direction of the sprite but whether the edge it hit is vertical or horizontal. A vertical wall needs 360-direction; a horizontal wall (otherwise known as the ceiling or the floor) needs 180-direction.

Do some experiments. For example, put the sprite near the top of the stage and set its direction to 350, and see what your BOUNCE does.

Ok, could you show me the script pic of your new and improved bounce block?

I hadn't made one, but here one is. It's a little complicated because of the case in which the sprite hits an exact corner of the stage.

Quite good! nice!

Nice! You might want to generalize it for variable stage dimensions... :slight_smile:

Also, the actual if on edge, bounce block also works if the sprite has since turned.

Uh, I also like the idea!

Some minor details though... (sorry for the nitpicking ;))

  1. It'd be way cooler, if the block worked for any stage size, meaning you should e.g. change the < > 179 to image

  2. The sprite bounces as soon as it touches the stage. In your version, the sprite can move its rotation center to the edge of the stage which means that half the costume is outside of the stage when your rotation center is at the center of the sprite (that's perfectly fine but not how the "if on edge bounce" block works).

  3. Technically, you can even move your sprite's x-position outside of the stage boundaries if you set the rotation center somewhere off the costume's center:

But Brian is right. Cool idea to reimplement some of the primitives to see how they work. It's not that easy sometimes :wink:


Yes, reimplement primitives is cool. And not only to see its way... also to find new ways and also to change behaviors (do what you want).

About "on edge"...

Really, "on edge" is justonEdge but yes, current "on edge..." is really "on edge or outside". But then, it is just onEdgeOrOutsite

No sizes, no calculations...

Note: If you change "my rotation x/y", current "if on edge, bounce" is not running ok. But "touching" sensors are still fine!
Maybe it is laggier... but I like it!


Very nice!

How does the actual if on edge, bounce block work then?

Oh, it works mostly the same, but instead of checking the numeric position of the sprite it checks "touching edge" which checks whether any part of the sprite is on an edge. You can use untitled script pic (right, top, bottom) to compute the edges of the sprite if you want to simulate it. (Computing whether or not this sprite is touching another sprite, which is irregularly shaped, is much more complicated.)