Discuss Scratch

consultWikipedia
Scratcher
51 posts

I am making a maze game, Please help

Hi all,

I am (Trying) to make a maze game with scrolling. I want it to look kind of like Wandering Knight - World 1, Only a maze. I am not sure how to make the scrolling work.

Thanks in advance,

@consultWikipedia

They call me “Batman Junior”
asivi
Scratcher
1000+ posts

I am making a maze game, Please help

This response could looks like an ironic one but it isn't.
You need to consult Scratch Wiki.
SuperFlower008
Scratcher
23 posts

I am making a maze game, Please help

consultWikipedia wrote:

Hi all,

I am (Trying) to make a maze game with scrolling. I want it to look kind of like Wandering Knight - World 1, Only a maze. I am not sure how to make the scrolling work.

Thanks in advance,

@consultWikipedia
Well, you are in luck! I know how to make a scrolling game! It's actually pretty simple!

1. Make 2 variables for every sprite that you want moving.

(X) and (Y)

2. Adjust the variables to where you want your sprite to be. (You need to go over how much the stage lets you to go to choose how far away the sprite is)

when green flag clicked
set [X] to [(How far the sprite is in the X cordonate)]
forever
set x to (X)
end

The same thing is for Y. Only that it changes the Y cordanate.

3. Make it to when the key of your chooise is pressed, change the X or Y cordonates. Example:

when green flag clicked
forever
if <key [right arrow] pressed?> then
change [X] by (-How fast you want the X cordonate to scroll)
end
if <key [down arrow] pressed?> then
change [Y] by (-How fast you want the Y cordonate to scroll)
end
end

It's the opposite for when you want it to go up and left. (The same thing but you don't have the “-” in there)

The rest… I don't really know how to make the maze work with this… (Also, if you don't want to see the sprites staying stuck on the sides, try to cover it with the square tool)

If you need help with another script or something, feel free to tell me!

Last edited by SuperFlower008 (Dec. 6, 2017 19:03:56)

consultWikipedia
Scratcher
51 posts

I am making a maze game, Please help

SuperFlower008 wrote:

consultWikipedia wrote:

Hi all,

I am (Trying) to make a maze game with scrolling. I want it to look kind of like Wandering Knight - World 1, Only a maze. I am not sure how to make the scrolling work.

Thanks in advance,

@consultWikipedia
Well, you are in luck! I know how to make a scrolling game! It's actually pretty simple!

1. Make 2 variables for every sprite that you want moving.

(X) and (Y)

2. Adjust the variables to where you want your sprite to be. (You need to go over how much the stage lets you to go to choose how far away the sprite is)

when green flag clicked
set [X] to [(How far the sprite is in the X cordonate)]
forever
set x to (X)
end

The same thing is for Y. Only that it changes the Y cordanate.

3. Make it to when the key of your chooise is pressed, change the X or Y cordonates. Example:

when green flag clicked
forever
if <key [right arrow] pressed?> then
change [X] by (-How fast you want the X cordonate to scroll)
end
if <key [down arrow] pressed?> then
change [Y] by (-How fast you want the Y cordonate to scroll)
end
end

It's the opposite for when you want it to go up and left. (The same thing but you don't have the “-” in there)

The rest… I don't really know how to make the maze work with this… (Also, if you don't want to see the sprites staying stuck on the sides, try to cover it with the square tool)

If you need help with another script or something, feel free to tell me!

Thanks, but I wanted to add walls to the maze. Does this mean I have to make loads of sprites or is there a way I can use clones of a single sprite?

They call me “Batman Junior”
SuperFlower008
Scratcher
23 posts

I am making a maze game, Please help

consultWikipedia wrote:

SuperFlower008 wrote:

consultWikipedia wrote:

Hi all,

I am (Trying) to make a maze game with scrolling. I want it to look kind of like Wandering Knight - World 1, Only a maze. I am not sure how to make the scrolling work.

Thanks in advance,

@consultWikipedia
Well, you are in luck! I know how to make a scrolling game! It's actually pretty simple!

1. Make 2 variables for every sprite that you want moving.

(X) and (Y)

2. Adjust the variables to where you want your sprite to be. (You need to go over how much the stage lets you to go to choose how far away the sprite is)

when green flag clicked
set [X] to [(How far the sprite is in the X cordonate)]
forever
set x to (X)
end

The same thing is for Y. Only that it changes the Y cordanate.

3. Make it to when the key of your chooise is pressed, change the X or Y cordonates. Example:

when green flag clicked
forever
if <key [right arrow] pressed?> then
change [X] by (-How fast you want the X cordonate to scroll)
end
if <key [down arrow] pressed?> then
change [Y] by (-How fast you want the Y cordonate to scroll)
end
end

It's the opposite for when you want it to go up and left. (The same thing but you don't have the “-” in there)

The rest… I don't really know how to make the maze work with this… (Also, if you don't want to see the sprites staying stuck on the sides, try to cover it with the square tool)

If you need help with another script or something, feel free to tell me!

Thanks, but I wanted to add walls to the maze. Does this mean I have to make loads of sprites or is there a way I can use clones of a single sprite?
Maybe… I don't know… It might be posible…
deck26
Scratcher
1000+ posts

I am making a maze game, Please help

@SuperFlower008's script doesn't look like it's doing any scrolling to me.

In my view if you can create a platformer (if not start with @griffpatch_tutor's tutorial) and a scroller (wiki pages a good place to start) it's not that difficult to put them together.

The main problem is that if you have multiple objects reacting to the scroll then moving them all and checking if the move is OK is a lot of work and will potentially cause lag so the better option is to use a custom block to move the player sprite, check if the move is valid and then undo the move. If the move was valie you THEN change scrollX/Y and let the other objects move while the player stays still as tends to be standard in a scroller. That's essentially the same technique that tends to work best in a platformer (move and undo an invalid move) which is why I say it's not that different.

The key thing is to understand how scrolling works and how scrollX/Y are just telling you now much of the real world you're actually seeing. Most objects are probably static in the real world so scrollX/Y is just a an adjustment to get their screen position (if on screen) from their real world position. For moving objects moving independently of the player the movement is best handled in real world coordinates so again the scrollX/Y adjustment is just used to define their screen position.
RPP-Exploration
Scratcher
500+ posts

I am making a maze game, Please help

consultWikipedia wrote:

Hi all,

I am (Trying) to make a maze game with scrolling. I want it to look kind of like Wandering Knight - World 1, Only a maze. I am not sure how to make the scrolling work.

Thanks in advance,

@consultWikipedia
Maybe you could do:
when [ up] key pressed
point in direction ( up)
move (10) steps
but make sure that you go into sprite info and play with the rotation options so the sprite doesn't turn upside down or something.


consultWikipedia
Scratcher
51 posts

I am making a maze game, Please help

deck26 wrote:

@SuperFlower008's script doesn't look like it's doing any scrolling to me.

In my view if you can create a platformer (if not start with @griffpatch_tutor's tutorial) and a scroller (wiki pages a good place to start) it's not that difficult to put them together.

The main problem is that if you have multiple objects reacting to the scroll then moving them all and checking if the move is OK is a lot of work and will potentially cause lag so the better option is to use a custom block to move the player sprite, check if the move is valid and then undo the move. If the move was valie you THEN change scrollX/Y and let the other objects move while the player stays still as tends to be standard in a scroller. That's essentially the same technique that tends to work best in a platformer (move and undo an invalid move) which is why I say it's not that different.

The key thing is to understand how scrolling works and how scrollX/Y are just telling you now much of the real world you're actually seeing. Most objects are probably static in the real world so scrollX/Y is just a an adjustment to get their screen position (if on screen) from their real world position. For moving objects moving independently of the player the movement is best handled in real world coordinates so again the scrollX/Y adjustment is just used to define their screen position.

I can make a static platformer, but not a scroller. This is the reason i asked the question, to learn how to make a scrolling game.

They call me “Batman Junior”
deck26
Scratcher
1000+ posts

I am making a maze game, Please help

consultWikipedia wrote:

I can make a static platformer, but not a scroller. This is the reason i asked the question, to learn how to make a scrolling game.
So start with the scrolling pages in the wiki and my project here may also help - https://scratch.mit.edu/projects/92682141/

Really try to get the idea of everything having ‘real world’ coordinates which don't change unless the object is moving in ‘real world’ terms. The scrolling is then just a window allowing you to see part of the real world so you have to work out what is visible when the window is in its current position.

Powered by DjangoBB

Standard | Mobile