Discuss Scratch

IanSan5653
Scratcher
40 posts

Is there any way to let a sprite go off screen?

I am trying to make a graph on the coordinate plane where the sprite goes to each coordinate. the problem is that some of the coordinates go off scree, so I need the sprite to keep going even after reaching the edge of the screen. My project is located here. (Use 2 for both A and B when asked)
BoltBait
Scratcher
1000+ posts

Is there any way to let a sprite go off screen?

If the sprite goes off screen you need to hide it.

Sorry, but the Scratch Team made a decision a long time ago not to let sprites go off screen so that new users would not be frustrated because they couldn't find their sprites.
MrLog
Scratcher
33 posts

Is there any way to let a sprite go off screen?

maybe there could be an option on the sprite menu to change whether it can go off screen or not? It can get annoying when using the pen, or using scrolling, and it doesn't go off the screen, or the pen draws to the wrong place. I know this should probably be in the suggestions page, but it seems relevant to this post you'd have to make it quite obvious to people new to scratch what the button was doing though
1st_scratcher
Scratcher
100+ posts

Is there any way to let a sprite go off screen?

I discovered what to do. After you mak the sprite put 1 pixel at each corner of the costume to make it larger. Then the part of the sprite people pay attention to ones off the screen but the nearly invisible dots will not.
andre_rifaut
Scratcher
100+ posts

Is there any way to let a sprite go off screen?

1st_scratcher wrote:

I discovered what to do. After you mak the sprite put 1 pixel at each corner of the costume to make it larger. Then the part of the sprite people pay attention to ones off the screen but the nearly invisible dots will not.

This might not work for all 4 sides of the main window because this might depend on the “center” that you fixed on your sprite (see crosshair in the editor) .
pugluv4ever
Scratcher
100+ posts

Is there any way to let a sprite go off screen?

Just make it move “offscreen” by going as far as possible and then erasing the edge of the sprite a little bit at a time. (or reshape it to make the edge smaller in vector)
timeuser
Scratcher
12 posts

Is there any way to let a sprite go off screen?

glide (44) secs to x: (40) y: (04)
idk
ScratchinJoJo
Scratcher
100+ posts

Is there any way to let a sprite go off screen?

You actually bypass the limitations of the screen borders using a clever trick.
You need to make 1 extra costume which should be a huge rectangle, (larger then the screen) and name it for example ‘__offscreenRect’
Then you change your costume to that one each time you move, then you use your move block, and then you switch back to your normal costume.
I can illustrate it with a custom block:

define go to (x) (y) with ability to move off screen
set [temp v] to (costume #) //save costume in temporary variable
switch costume to [__offscreenRect v] //switch to large rectangle
go to x: (x) y: (y) //move
switch costume to (temp) //switch costume back

Let's explain why this is so magical.
Have you ever noticed that a larger sprite can move further off screen? A larger sprite has a higher max x and y position. We can use this in our advantage to move far off screen, by drawing a huge rectangle. The best thing is that Scratch only checks your sprite from being on it's max position when you actually move, but when you move first with a larger sprite, it's not on it's max, and when you switch costumes back, scratch doesn't check that position again, and so your sprite can move off screen. The larger your rectangle is, the further the sprite can move off screen.
(There is a similar trick for bypassing the max size of a sprite)

! – Use this at your own risk – !
It could be that scratch fixes this in the next update (probably not but it could be) and so your project won't work anymore.

Alternatively, you could hide your sprite when it reaches it's border. If you want to try that, you can use my SuperMotion movement engine: https://scratch.mit.edu/projects/62077890/ which has a ton of helpful movement functions, and is pen friendly thanks to @DadOfMrLog

Hope it helped!

Last edited by ScratchinJoJo (May 28, 2015 15:59:36)

turquoisetrapezoid59
Scratcher
28 posts

Is there any way to let a sprite go off screen?

MrLog wrote:

maybe there could be an option on the sprite menu to change whether it can go off screen or not? It can get annoying when using the pen, or using scrolling, and it doesn't go off the screen, or the pen draws to the wrong place. I know this should probably be in the suggestions page, but it seems relevant to this post you'd have to make it quite obvious to people new to scratch what the button was doing though

that is a great idea!
Sylvester3000
Scratcher
100+ posts

Is there any way to let a sprite go off screen?

You will have to hide it using the
hide
block
BF10
Scratcher
500+ posts

Is there any way to let a sprite go off screen?

Please don't necrobump.
SteveMinecraftson
Scratcher
8 posts

Is there any way to let a sprite go off screen?

Last edited by SteveMinecraftson (Jan. 21, 2016 20:24:03)

Powered by DjangoBB