Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how to make collisions with invisible walls
- menikin1
-
Scratcher
48 posts
how to make collisions with invisible walls
I am trying to get my sprite to stop going through my walls. It has to be invisible or else it looks weird. Thanks.
- Uniquename1
-
Scratcher
100+ posts
how to make collisions with invisible walls
If touching sprite or color should both work even if ghost effect is set to 100.
Alternatively if the walls are on the border that the sprite can't go out of then
With this he will only move up to about 200, then if he's further over than that he won't move anymore to the right. Essentially like hitting a wall.
Alternatively if the walls are on the border that the sprite can't go out of then
if <<key [right arrow] pressed?> and <(x position) < [200]>> then
change x by (10)
end
With this he will only move up to about 200, then if he's further over than that he won't move anymore to the right. Essentially like hitting a wall.
- Pezd
-
Scratcher
100+ posts
how to make collisions with invisible walls
The trick is that the sensing block
<touching [sprite6 v] ?>still works when ‘sprite6’ has the ghost effect turned all the way.
- cs641311
-
Scratcher
100+ posts
how to make collisions with invisible walls
Try setting the color of the invisable walls to the color of the background that will make the wall seem invisable.
- -Nostalgic-
-
Scratcher
6 posts
how to make collisions with invisible walls
I am trying to get my sprite to stop going through my walls. It has to be invisible or else it looks weird. Thanks.Instead of using the hide block, use
set [ Ghostv] effect to (100)

- menikin1
-
Scratcher
48 posts
how to make collisions with invisible walls
The trick is that the sensing block<touching [sprite6 v] ?>still works when ‘sprite6’ has the ghost effect turned all the way.
How do I make it not go through though?
- PhoenixDragonBlue
-
Scratcher
100+ posts
how to make collisions with invisible walls
Write this in the wall script :
Also, when making the
when green flag clickedand this in the object to be blocked by the wall's script:
set [ghost v] effect to (100)
when green flag clickedYou may have to replace
forever
Touching wall? ::custom
end
define Touching wall?
if <touching [Wall v] ?> then
repeat until <not <touching [Wall v] ?>
change y by (-1)
change y by (-1)to
change y by (1)depending on which side the wall is on.
Also, when making the
Touching wall? ::custombe sure to check the “Run Without Screen Refresh” box.
- menikin1
-
Scratcher
48 posts
how to make collisions with invisible walls
Write this in the wall script :when green flag clickedand this in the object to be blocked by the wall's script:
set [ghost v] effect to (100)when green flag clickedYou may have to replace
forever
Touching wall? ::custom
end
define Touching wall?
if <touching [Wall v] ?> then
repeat until <not <touching [Wall v] ?>
change y by (-1)change y by (-1)tochange y by (1)depending on which side the wall is on.
Also, when making theTouching wall? ::custombe sure to check the “Run Without Screen Refresh” box.
Thanks, this worked.
- PhoenixDragonBlue
-
Scratcher
100+ posts
how to make collisions with invisible walls
No problem-snip-
Thanks, this worked.

- Discussion Forums
- » Help with Scripts
-
» how to make collisions with invisible walls