Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Need help on making a scrolling map
- Alihene222
-
Scratcher
12 posts
Need help on making a scrolling map
So recently I wanted to make a scrolling map for an rpg game. I have made a decent small map with controls, but I just can't understand how to make other sprites scrolling as well. I want a separate door sprite in a specific place of my map, but I have no idea how it is done and I cannot find tutorials on youtube. This is my current project: https://scratch.mit.edu/projects/546264318 All help is appreciated. Thanks in advance.
Last edited by Alihene222 (June 19, 2021 12:57:56)
- BatteRaquette58
-
Scratcher
100+ posts
Need help on making a scrolling map
Watch a tutorial by Griffpatch called “Scrolling Background” on Youtube. It uses a sprite for a background so you can do the same with your sprites.
Hope this helped!
Hope this helped!
- Alihene222
-
Scratcher
12 posts
Need help on making a scrolling map
Watch a tutorial by Griffpatch called “Scrolling Background” on Youtube. It uses a sprite for a background so you can do the same with your sprites.It didn't help much because all I want is to move multiple sprites at the same time and have them remain in their position on the moving map.
Hope this helped!
- Yusei-Fudo
-
Scratcher
1000+ posts
Need help on making a scrolling map
It didn't help much because all I want is to move multiple sprites at the same time and have them remain in their position on the moving map.
I can help with that. Give me a few minutes.
- Yusei-Fudo
-
Scratcher
1000+ posts
Need help on making a scrolling map
Ok, I'm back.
Do this:
First, create a new variable named x and y “For this sprite only”. Do it for all sprites:


Then, assign a value to each x and y variables of each sprite. They control where a sprite “will be” on a scrolling level.
Then, make 2 variables named SCROLL X AND SCROLL Y “For all sprites”


Then, you can create your own scripts to change those variables (if you need a guide for that too, I can help with that as well)
After that, do these scripts:

That script is used to position sprites and hide them when “off screen”.

Then, you should see the go to ()() block like the one at the bottom of the last picture.
Drag it out, and create this:
Hope this helps you.
IF ANYONE IS GOING TO QUOTE THIS, PLEASE REMOVE THE IMAGE URLS.
Do this:
First, create a new variable named x and y “For this sprite only”. Do it for all sprites:


Then, assign a value to each x and y variables of each sprite. They control where a sprite “will be” on a scrolling level.
Then, make 2 variables named SCROLL X AND SCROLL Y “For all sprites”


Then, you can create your own scripts to change those variables (if you need a guide for that too, I can help with that as well)
After that, do these scripts:

That script is used to position sprites and hide them when “off screen”.

Then, you should see the go to ()() block like the one at the bottom of the last picture.
Drag it out, and create this:
define go to (x)(y)
//ignore this for now as you've already created this block. Do the scripts below with the custom block shown above.
go to ((x)-(SCROLL X))((y)-(SCROLL Y)):: Custom
//With that done, all you have to do is this:
forever
...
broadcast [position sprites]
...
end
//do this in all the sprites you want to scroll
when i receive [position sprites]
go to ((x)-(SCROLL X))((y)-(SCROLL Y)):: Custom
Hope this helps you.
IF ANYONE IS GOING TO QUOTE THIS, PLEASE REMOVE THE IMAGE URLS.
- Alihene222
-
Scratcher
12 posts
Need help on making a scrolling map
Ok, I'm back.Sorry for late response, but thanks!
Do this:
First, create a new variable named x and y “For this sprite only”. Do it for all sprites:
Then, assign a value to each x and y variables of each sprite. They control where a sprite “will be” on a scrolling level.
Then, make 2 variables named SCROLL X AND SCROLL Y “For all sprites”
Then, you can create your own scripts to change those variables (if you need a guide for that too, I can help with that as well)
After that, do these scripts:
That script is used to position sprites and hide them when “off screen”.
Then, you should see the go to ()() block like the one at the bottom of the last picture.
Drag it out, and create this:define go to (x)(y)
//ignore this for now as you've already created this block. Do the scripts below with the custom block shown above.
go to ((x)-(SCROLL X))((y)-(SCROLL Y)):: Custom
//With that done, all you have to do is this:
forever
...
broadcast [position sprites]
...
end
//do this in all the sprites you want to scroll
when i receive [position sprites]
go to ((x)-(SCROLL X))((y)-(SCROLL Y)):: Custom
Hope this helps you.
IF ANYONE IS GOING TO QUOTE THIS, PLEASE REMOVE THE IMAGE URLS.
Last edited by Alihene222 (July 2, 2021 20:21:14)
- QuickMuffin8782
-
Scratcher
26 posts
Need help on making a scrolling map
You will also need this event as it helps your game big time. Griffpatch used this event:
when I receive [tick v]
- Thingied
-
Scratcher
1000+ posts
Need help on making a scrolling map
You will also need this event as it helps your game big time. Griffpatch used this event:You don't need it, it's optional. You can just use a standard forever loop and get the same result.when I receive [tick v]
when gf clicked
forever
Last edited by Thingied (July 2, 2021 22:35:19)
- Alihene222
-
Scratcher
12 posts
Need help on making a scrolling map
Ok, I'm back.
Do this:
First, create a new variable named x and y “For this sprite only”. Do it for all sprites:
Then, assign a value to each x and y variables of each sprite. They control where a sprite “will be” on a scrolling level.
Then, make 2 variables named SCROLL X AND SCROLL Y “For all sprites”
Then, you can create your own scripts to change those variables (if you need a guide for that too, I can help with that as well)
After that, do these scripts:
That script is used to position sprites and hide them when “off screen”.
Then, you should see the go to ()() block like the one at the bottom of the last picture.
Drag it out, and create this:define go to (x)(y)
//ignore this for now as you've already created this block. Do the scripts below with the custom block shown above.
go to ((x)-(SCROLL X))((y)-(SCROLL Y)):: Custom
//With that done, all you have to do is this:
forever
...
broadcast [position sprites]
...
end
//do this in all the sprites you want to scroll
when i receive [position sprites]
go to ((x)-(SCROLL X))((y)-(SCROLL Y)):: Custom
Hope this helps you.
IF ANYONE IS GOING TO QUOTE THIS, PLEASE REMOVE THE IMAGE URLS.
I need help with the scripts to change the variables since I am still a bit confused. Thanks in advance.
Edit: I'm back and I figured it out. Thanks for the scrolling guide though.
Last edited by Alihene222 (July 3, 2021 10:56:56)
- Discussion Forums
- » Help with Scripts
-
» Need help on making a scrolling map





