Discuss Scratch
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
Has anyone heard of diep.io, or slither io or agar.io? if so, i want to make a game like those. I need to make it so that you can move around a large map in all directions, basically making it possible to scroll in all directions. Any help?
- JollyWinter
-
100+ posts
4 Way scrolling?
Here's a project that may help.
https://scratch.mit.edu/projects/378861802/
https://scratch.mit.edu/projects/378861802/
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
wow thats some complex scripts. would you mind adding comments for like every single block pleease
thanks!
thanks!
- JollyWinter
-
100+ posts
4 Way scrolling?
Basically you want 2 new variables, camX camY or scrollx scrolly, then instead of changing x and y you change camX and camY
Use this code in the non-player sprites (myX and myY are this sprite only)
Since you're making agar.io when you spawn the food you'll want to set camX and camY to a random number to spread them out
Use this code in the non-player sprites (myX and myY are this sprite only)
go to x: ((myX) - (camX)) y: ((myY) - (camY))
Since you're making agar.io when you spawn the food you'll want to set camX and camY to a random number to spread them out
Last edited by JollyWinter (April 11, 2020 18:43:52)
- JollyWinter
-
100+ posts
4 Way scrolling?
Here's a simpler version
https://scratch.mit.edu/projects/384622820/
https://scratch.mit.edu/projects/384622820/
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
actually agar is too complex for me right now, so im making a different game, similar to diep io
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
yo dude in the diep io test project you sent me the grid sprite had a size of 200, and i copied the costume and tried to make it 200% but it didnt work. do you know why?
project link:
https://scratch.mit.edu/projects/383285487/
project link:
https://scratch.mit.edu/projects/383285487/
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
Also, this might be off-topic, but how does the right arrow minus left arrow pressed thing work?
is it because when true it is has a value of 1 and when false it has a value of 0?
is it because when true it is has a value of 1 and when false it has a value of 0?
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
yo dude in the diep io test project you sent me the grid sprite had a size of 200, and i copied the costume and tried to make it 200% but it didnt work. do you know why?
project link:
https://scratch.mit.edu/projects/383285487/
never mind i figured it out, and i understand why there was a blank costume now
- JollyWinter
-
100+ posts
4 Way scrolling?
yo dude in the diep io test project you sent me the grid sprite had a size of 200, and i copied the costume and tried to make it 200% but it didnt work. do you know why?Scratch only allows you to go to a certain point, so you make a blank costume and you can set that to whatever size you want, then just change back to the costume you want to be big.
project link:
https://scratch.mit.edu/projects/383285487/
yeah, basically Also, this might be off-topic, but how does the right arrow minus left arrow pressed thing work?
is it because when true it is has a value of 1 and when false it has a value of 0?
if you're pressing right arrow it will be 1 - 0, if you're pressing left it will be 0 - 1, and if you're pressing both it will be 1 - 1, so you'll move in the corresponding directions of 1 -1 and 0
Last edited by JollyWinter (April 11, 2020 19:59:29)
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
oh ok thanksyo dude in the diep io test project you sent me the grid sprite had a size of 200, and i copied the costume and tried to make it 200% but it didnt work. do you know why?Scratch only allows you to go to a certain point, so you make a blank costume and you can set that to whatever size you want, then just change back to the costume you want to be big.
project link:
https://scratch.mit.edu/projects/383285487/yeah, basically Also, this might be off-topic, but how does the right arrow minus left arrow pressed thing work?
is it because when true it is has a value of 1 and when false it has a value of 0?
if you're pressing right arrow it will be 1 - 0, if you're pressing left it will be 0 - 1, and if you're pressing both it will be 1 - 1, so you'll move in the corresponding directions of 1 -1 and 0
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
Also, now that you have helped me with the scrolling basic parts, can you help me with making it so that it is infinetly scrolling, because when I use the script which you made, then it has invisible borders which you cant go past.
If you don't know how to help me with that then can you just help me with making the borders visible please?
thanks
If you don't know how to help me with that then can you just help me with making the borders visible please?
thanks
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
Also, now that you have helped me with the scrolling basic parts, can you help me with making it so that it is infinetly scrolling, because when I use the script which you made, then it has invisible borders which you cant go past.
If you don't know how to help me with that then can you just help me with making the borders visible please?
thanks
Never mind (again) I figured it out just after posting this, so please ignore

- DBZboy21Gaming
-
95 posts
4 Way scrolling?
yo i need more help again
and basically if u check out my project, you will see that ive added a chest with no purpose at the moment. now i have given it a certain position at the moment and to find it you must change you y by a negative amount. but the problem you will notice is that the chest keeps shaking a bit, unless youre completely still. can you help me fix it?
link https://scratch.mit.edu/projects/383285487/

link https://scratch.mit.edu/projects/383285487/
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
i made it slightly hard to find so basically just go left a little bit and then go down :)
Last edited by DBZboy21Gaming (April 12, 2020 14:04:56)
- JollyWinter
-
100+ posts
4 Way scrolling?
For any kind of shaking you can use a broadcast (e.g. Go to) and then make it so that when that's called the sprite goes to the designated spot. Call the broadcast in the same loop that changes camX and camY in the player sprite.
- DBZboy21Gaming
-
95 posts
4 Way scrolling?
hey dude i know this is off topic, but quickly check out my project and the remix of it, because there the exact same but it doesnt work and i need help to fix it thanks! For any kind of shaking you can use a broadcast (e.g. Go to) and then make it so that when that's called the sprite goes to the designated spot. Call the broadcast in the same loop that changes camX and camY in the player sprite.