Discuss Scratch

logais
Scratcher
100+ posts

help with maze game

hi everyone, I was making a maze game and I built the base, but my colisions aren't working. can anyone help?
https://scratch.mit.edu/projects/418918080/
FateSealer
Scratcher
100+ posts

help with maze game

I believe, you are trying to move the maze instead of the player.
FateSealer
Scratcher
100+ posts

help with maze game

And, your maze being resized to 6000%, Scratch cannot make it move.
logais
Scratcher
100+ posts

help with maze game

yeah, I know. the maze moves, not the player so the player always stays in the center of the the screen. kinda like a birds-eye-view scrolling platformer, but thanks for the suggestion, see if you can find the problem.
FateSealer
Scratcher
100+ posts

help with maze game

OK. I'd suggest a smaller, scrolling maze for this purpose.
logais
Scratcher
100+ posts

help with maze game

the maze can still move at 6000% It worked before l added the conclusion scripts
logais
Scratcher
100+ posts

help with maze game

yeah, but can you see the problem?
FateSealer
Scratcher
100+ posts

help with maze game

It seems, only the “touch” blocks of the code are problematic.
FateSealer
Scratcher
100+ posts

help with maze game

The touching block may be too computation expensive. I don't have any better guess.
FateSealer
Scratcher
100+ posts

help with maze game

It thinks that red is ALWAYS touching black.
logais
Scratcher
100+ posts

help with maze game

but why?
FateSealer
Scratcher
100+ posts

help with maze game

Actually, I never trust the “touch-color” block completely.

To be honest, I never really trust the “touch-sprite” block either.

But maybe someone has more experience with them and can give you a real advice related to these blocks.

I personally would suggest, that you try to start experiment with a small(er) maze, and see if it works well, before proceeding towards greater mazes.
logais
Scratcher
100+ posts

help with maze game

ok, thanks for the advice
Vaughnderrick
Scratcher
12 posts

help with maze game

Yet
logais
Scratcher
100+ posts

help with maze game

um, hi vaughnderrick, do you know how to help me?
EpicGhoul993
Scratcher
1000+ posts

help with maze game

As FateSealer said, you should try to make multiple maze pieces and add scrolling to them (like a 4-way basic scrolling platformer). Also, you should watch a short tutorial about collisions generally by Professor Blue to get the basic ideas.
logais
Scratcher
100+ posts

help with maze game

Ok, can’t you just give me the scripts for it though?
deck26
Scratcher
1000+ posts

help with maze game

I thought I'd change the colour of the player just to test the maze without worrying abou the player and the touching colour. The maze will move when the size is up to 250% but doesn't move at 300%.

Multiple maze clones would be a better approach. https://scratch.mit.edu/projects/51479882/ may help. Although the world is a 6 x 6 grid I only use 9 clones as there are never more than 9 clones visible on screen at once - clones go off one side and are reused at the other side for example. So the world size doesn't matter too much and could be bigger than 6 x 6.

I'd also suggest handlng your movement this way - move the player sprite as you would for a non-scroller. If it doesn't touch the maze wall you know the move is valid. Now move the player back to the middle. if the move was valied change scrollx/y as appropriate. This validation of a move can be done quickly in a custom block invisible to the user.

Once a move is validated you can tell the maze clones to move. They know their new position from the values of scrollx/y. If the move was shown as invalid you don't tell the maze to move.
logais
Scratcher
100+ posts

help with maze game

Thanks deck26, these are all very good suggestions, I will definitely try them and see if I can get it working!
FateSealer
Scratcher
100+ posts

help with maze game

Thanks @deck26 for your shared project:
https://scratch.mit.edu/projects/51479882/

But, I believe, your project suffers from the “near-the-edge” scrolling defect (both horizontally and vertically). I mean, if any of your clones goes near to the edge of the stage via scrolling (say, closer than 16px), than it will not be shown properly. More explicitly, your adjacent clones will overlap.

That is why several scrolling projects have a border around the stage, which might be a more or less acceptable workaround for this problem. (I am not trying to suggest this workaround.)

Powered by DjangoBB