Discuss Scratch

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!
Alihene222
Scratcher
12 posts

Need help on making a scrolling map

BatteRaquette58 wrote:

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!
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.
Yusei-Fudo
Scratcher
1000+ posts

Need help on making a scrolling map

Alihene222 wrote:

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:
definegotoxyignore this for now as you've already created this block. Do the scripts below with the custom block shown above.gotox-SCROLLXy-SCROLLYWith that done, all you have to do is this:forever. . .broadcastposition sprites. . .do this in all the sprites you want to scrollwhenireceiveposition spritesgotox-SCROLLXy-SCROLLY

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

Yusei-Fudo wrote:

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:
definegotoxyignore this for now as you've already created this block. Do the scripts below with the custom block shown above.gotox-SCROLLXy-SCROLLYWith that done, all you have to do is this:forever. . .broadcastposition sprites. . .do this in all the sprites you want to scrollwhenireceiveposition spritesgotox-SCROLLXy-SCROLLY

Hope this helps you.


IF ANYONE IS GOING TO QUOTE THIS, PLEASE REMOVE THE IMAGE URLS.
Sorry for late response, but thanks!

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:
whenIreceivetick
Thingied
Scratcher
1000+ posts

Need help on making a scrolling map

QuickMuffin8782 wrote:

You will also need this event as it helps your game big time. Griffpatch used this event:
whenIreceivetick
You don't need it, it's optional. You can just use a standard forever loop and get the same result.
whenclickedforever

Last edited by Thingied (July 2, 2021 22:35:19)

Alihene222
Scratcher
12 posts

Need help on making a scrolling map

Yusei-Fudo wrote:

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:
definegotoxyignore this for now as you've already created this block. Do the scripts below with the custom block shown above.gotox-SCROLLXy-SCROLLYWith that done, all you have to do is this:forever. . .broadcastposition sprites. . .do this in all the sprites you want to scrollwhenireceiveposition spritesgotox-SCROLLXy-SCROLLY

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)

TnT_Red
Scratcher
1 post

Need help on making a scrolling map

How to do this ?

Powered by DjangoBB