Discuss Scratch

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

ifkeyright arrowpressed?andxposition<200thenchangexby10

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
touchingsprite6?
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

menikin1 wrote:

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 Ghostveffectto100

menikin1
Scratcher
48 posts

how to make collisions with invisible walls

Pezd wrote:

The trick is that the sensing block
touchingsprite6?
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 :
whenclickedsetghosteffectto100
and this in the object to be blocked by the wall's script:
whenclickedforeverTouchingwall?defineTouchingwall?iftouchingWall?thenrepeatuntilnottouchingWall?changeyby-1
You may have to replace
changeyby-1
to
changeyby1
depending on which side the wall is on.
Also, when making the
Touchingwall?
be sure to check the “Run Without Screen Refresh” box.
menikin1
Scratcher
48 posts

how to make collisions with invisible walls

PhoenixDragonBlue wrote:

Write this in the wall script :
whenclickedsetghosteffectto100
and this in the object to be blocked by the wall's script:
whenclickedforeverTouchingwall?defineTouchingwall?iftouchingWall?thenrepeatuntilnottouchingWall?changeyby-1
You may have to replace
changeyby-1
to
changeyby1
depending on which side the wall is on.
Also, when making the
Touchingwall?
be sure to check the “Run Without Screen Refresh” box.

Thanks, this worked.
PhoenixDragonBlue
Scratcher
100+ posts

how to make collisions with invisible walls

menikin1 wrote:

PhoenixDragonBlue wrote:

-snip-

Thanks, this worked.
No problem

Powered by DjangoBB