Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make Sprites go off screen and stay where it should be
- amylaser
-
500+ posts
How to make Sprites go off screen and stay where it should be
Check out griffpatch's tutorials on scrolling:
scrolling in general: https://scratch.mit.edu/projects/93201751/
tile-based scrolling (good for platformers of this sort): https://scratch.mit.edu/projects/23134940/
scrolling in general: https://scratch.mit.edu/projects/93201751/
tile-based scrolling (good for platformers of this sort): https://scratch.mit.edu/projects/23134940/
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
Ok, i'll do that after i get back from school, lol theres school in Saturday, i have to go to bed now, btw i know griffpatch, he's the best Scratcher known Check out griffpatch's tutorials on scrolling:
scrolling in general: https://scratch.mit.edu/projects/93201751/
tile-based scrolling (good for platformers of this sort): https://scratch.mit.edu/projects/23134940/

- Pix3lAnimator
-
49 posts
How to make Sprites go off screen and stay where it should be
Check out tutorials on scrolling and that type of scripting I recommend @GriffPatch
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
Ok, i'm back from school, now to it's time to learn, in scratch…XD Check out tutorials on scrolling and that type of scripting I recommend @GriffPatch
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
Nope didn't help… Check out griffpatch's tutorials on scrolling:
scrolling in general: https://scratch.mit.edu/projects/93201751/
tile-based scrolling (good for platformers of this sort): https://scratch.mit.edu/projects/23134940/
- TheLogFather
-
1000+ posts
How to make Sprites go off screen and stay where it should be
Do you just mean that you want to know how to make a sprite slide ‘gracefully’ off the edge of the screen without getting ‘stuck’ at the edges?
If so, take a look at this demo project: https://scratch.mit.edu/projects/45908972/
Ignore the ‘wraparound’ aspect, and just concentrate on the comments inside that describe how the sprite can move off the edge of the screen without getting stuck.
If so, take a look at this demo project: https://scratch.mit.edu/projects/45908972/
Ignore the ‘wraparound’ aspect, and just concentrate on the comments inside that describe how the sprite can move off the edge of the screen without getting stuck.
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
Yes Do you just mean that you want to know how to make a sprite slide ‘gracefully’ off the edge of the screen without getting ‘stuck’ at the edges?
If so, take a look at this demo project: https://scratch.mit.edu/projects/45908972/
Ignore the ‘wraparound’ aspect, and just concentrate on the comments inside that describe how the sprite can move off the edge of the screen without getting stuck.

- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
Actually, no, i want the Polygons to go off screen and stay where it should be, like Agar.io's Food, but Instead, Diep.io's Polygons (and Bullets)
To be Specific, I want the Polygons to go off screen and stay right where it spawned even you can't see it
Example: a Yellow Square going out of my View, and when i go back towards it, it's still where it Spawned
Do you Understand?
To be Specific, I want the Polygons to go off screen and stay right where it spawned even you can't see it
Example: a Yellow Square going out of my View, and when i go back towards it, it's still where it Spawned
Do you Understand?
- awesome-llama
-
1000+ posts
How to make Sprites go off screen and stay where it should be
You need to save the locations to variables. You can create 2 local variables, x and y. When the pentagon spawns, it needs the 2 variables to be set to it's position, and that is where it forever goes to.
- TheLogFather
-
1000+ posts
How to make Sprites go off screen and stay where it should be
OK, yes – then see awesome-llama's reply above… You need to store an object's X,Y position in a couple of “this sprite only” variables (let's call them “My X” and “My Y”), and update those just as you would its X,Y position. However, when you place the object on the screen, you would just ‘offset’ these values by some ScrollX & ScrollY values: Actually, no, i want the Polygons to go off screen and stay where it should be, like Agar.io's Food, but Instead, Diep.io's Polygons (and Bullets)
To be Specific, I want the Polygons to go off screen and stay right where it spawned even you can't see it
Example: a Yellow Square going out of my View, and when i go back towards it, it's still where it Spawned
Do you Understand?
(Note that it's possible you may need to add ScrollX & ScrollY, instead of subtract, if you have written them to update the opposite way around to what I'm expecting for this. It'll work either way, as long as you do the updating of them consistently with the add or subtract.)
Since these objects end up moving off the edge of the screen, you will also need to use a method such as the one I linked above to prevent them from getting stuck at the edges…
Also, you probably want to hide the sprite when all of it has definitely gone right off the edge of the screen (and re-show it when part of it starts to come back on). – But also have a local variable which keeps its current state (i.e. visible or hidden), so that you are not continually running a “show” block all the time it is on-screen (instead, only doing one “show” when it first re-appears back on the screen).
Last edited by TheLogFather (Sept. 10, 2016 12:38:36)
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
K, i kinda Understand what you mean, but i might have forgotten how to do Scrolling Stuff, so i'll go check some Tutorials and try to do what you said 
Would you mind if i keep asking Questions? if so, i'm sorry, i don't mean to cause any Trouble

Would you mind if i keep asking Questions? if so, i'm sorry, i don't mean to cause any Trouble

- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
I see what you mean, But wait, i don't want just One Polygon, i want lots, who wants to play it if there were only 3 Polygons Existing…lol
So what do i do? i don't wanna make Tons of Variables, Probably a List? but isn't that much harder…
So what do i do? i don't wanna make Tons of Variables, Probably a List? but isn't that much harder…
- TheLogFather
-
1000+ posts
How to make Sprites go off screen and stay where it should be
You don't make “tons of variables”. You only make a single pair of *local* variables (i.e. “this sprite only” variables).
Each clone (and the original sprite) has its own copy of such variables, and they change independently of each other.
Each clone (and the original sprite) has its own copy of such variables, and they change independently of each other.
Last edited by TheLogFather (Sept. 10, 2016 17:43:57)
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
So you mean if i make 2 Variables (X/Y) for the Yellow Square Polygon, it applies to all of its clones? You don't make “tons of variables”. You only make a single pair of *local* variables (i.e. “this sprite only” variables).
Each clone (and the original sprite) has its own copy of such variables, and they change independently of each other.
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
Omg it works!!! it stays where it spawned but 2 things…1. it spawns where i spawn and can't be moved (which makes a tight group of them) 2. it still shows on the Edge of the Screen
Did i put the Script at the Wrong place? or do i have to make a Separate one? idk
Did i put the Script at the Wrong place? or do i have to make a Separate one? idk
- DraGoBoom
-
58 posts
How to make Sprites go off screen and stay where it should be
Nvm, i Figured it Out! 
This Topic can now be Closed

This Topic can now be Closed

- awesome-llama
-
1000+ posts
How to make Sprites go off screen and stay where it should be
There is a close topic button below, which you can click. Nvm, i Figured it Out!
This Topic can now be Closed
- Discussion Forums
- » Help with Scripts
-
» How to make Sprites go off screen and stay where it should be