Discuss Scratch

AlphaNinjaBoss
Scratcher
4 posts

How to make walls

Im stuck in how to make walls plszz helps
scritchscrutch
Scratcher
32 posts

How to make walls

AlphaNinjaBoss wrote:

Im stuck in how to make walls plszz helps
-

Hi, for starters you can add walls as a sprite and code it something like:

whenclickedforeveriftouchingwalls?theninsertscripthere
helloworldbyeworld
Scratcher
1000+ posts

How to make walls

Do you mean a collision detecting script? If so, make a sprite that contains all the walls, then insert this script:

whenclickedforeverpointindirectiondirectionofmovementifmove?thenmove1stepsiftouchingwalls?andmove?thenmove-1steps this undoes the movement if it's touching the walls

Last edited by helloworldbyeworld (Oct. 24, 2021 20:37:22)

AlphaNinjaBoss
Scratcher
4 posts

How to make walls

Thank you guys for ur help but the problem is I used to be really good at coding scratch blocks but than I stopped for 2 years or so and i forgot most of the stuff. So if u guys could just be a little more specific ( like when scritchscrutch made the insert script here block it kinda leaves me hanging and hellobyeworld I can't understand what those gray blocks are at first I thot they were variables but i don't think the “move?” boolean is a variable) so thx but just be a little more specific plzz

bluedragon8633
Scratcher
1000+ posts

How to make walls

AlphaNinjaBoss wrote:

Thank you guys for ur help but the problem is I used to be really good at coding scratch blocks but than I stopped for 2 years or so and i forgot most of the stuff. So if u guys could just be a little more specific ( like when scritchscrutch made the insert script here block it kinda leaves me hanging and hellobyeworld I can't understand what those gray blocks are at first I thot they were variables but i don't think the “move?” boolean is a variable) so thx but just be a little more specific plzz

First, make sure to never spell “thought” as “thot”. There might be a filter for it somewhere.

Scritchscrutch's “insert script here” is where you should put in reactions to the walls. For example, collision or saying “ouch” or whatever.

The gray blocks are the Forums' built-in way of saying “insert script here”.

There are no move booleans anywhere in Scratch; they are action blocks.
variablevariable blocks are orangemove5stepsblocks that perform actions are basically rectangularandbooleans are hexagonal.
AlphaNinjaBoss
Scratcher
4 posts

How to make walls

oh ok thx
AlphaNinjaBoss
Scratcher
4 posts

How to make walls

I found a script that worked better for me bet thx all for your help



here is the project that i used it in
https://scratch.mit.edu/projects/592796564/
bluedragon8633
Scratcher
1000+ posts

How to make walls

While it does work, it would be more efficient to add the <touching end wall?> code inside <key right arrow pressed?>. It uses fewer blocks and keeps things within a central loop (generally a good idea, especially for larger projects.)

On a side note, where did you get your platforming code? It's very simple, and is still fully functional.
Newton-Studios
Scratcher
1 post

How to make walls

Powered by DjangoBB