Discuss Scratch

Lunarian
Scratcher
25 posts

Wall collision in a side-scroller.

Hello again, fellow Scratchers…

I'm working on a platformer game and I need help with the wall collision in it.

I just need the screen to stop scrolling when the purple box sprite hits a wall. If anyone could help me with this, that would be great! Thanks.

Link to game: http://scratch.mit.edu/projects/49938308/#editor
deck26
Scratcher
1000+ posts

Wall collision in a side-scroller.

I suspect you'd find it easier if you were using different colours for different bits of the world or have different colours at the side and top/bottom of the moving block. Otherwise you want to be able to move horizontally if you're touching the background at the bottom of the sprite (you're on the ground) but not it you're touching it at the right side when trying to move right but have no way to differentiate.

You could use the ‘colour touching colour’ block perhaps or split the walls and floors into different sprites if you want ‘touching sprite’ to be how you interact with the world.
Bellydancer3259
New Scratcher
1 post

Wall collision in a side-scroller.

I am having the same problem! when the sprite hits a wall it continues to scroll without the sprite…
deck26
Scratcher
1000+ posts

Wall collision in a side-scroller.

Bellydancer3259 wrote:

I am having the same problem! when the sprite hits a wall it continues to scroll without the sprite…
Please create your own new topic rather than necroposting and share the project.
mrpickles34
Scratcher
1 post

Wall collision in a side-scroller.

I'm making a side scroll game but i don't know a way to make the wall collision right It will just keep going up do you know how to help with that

Powered by DjangoBB