"If past edge, wrap" block

image
Feel free to use this in any of your projects.
If you find issues with the block, please let me know.

I like the movement in this, the block also works quite well :3

I already made this in my custom block project...

Like plagiarism, or like this is another way to solve a problem?

This is another way. I used IF X > WHATEVER. He used complicated math stuff that I didnt look closely at.

I also used

but calculating the "whatever" part uses

In your code, I think you assume that the pivot is at the center of the sprite ...

  1. Draw a sprite about the width of the stage
  2. Place the pivot completely to the right of the sprite
  3. Check the variable x position
    image

If you move the sprite to the right, it will reappear way too far to the left (roughly -680 instead of nearly -240 ...)

image
image

Find a new formula using these blocks:
image

I have a working version in my custom block collection.

Thanks!
Edit: Updated the project.

.. Sorry to be that guy but I don’t understand what it does​:sweat_smile:

Oups, it's worse ! the sprite get stuck on the left...

press w in this project
https://snap.berkeley.edu/snap/snap.html#present:Username=loucheman&ProjectName=forum%20help-%20wrap%20-%20helicoptur&editMode&noRun

hint:
image

It's like "if on edge, bounce" but if the sprite is past the edge, it wraps around.

can i use the sprite from the project that this block is in

uh... sure...? (is it for the movement?)

yesss