This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2010-05-25 08:01:09

HotHead25
Scratcher
Registered: 2010-05-25
Posts: 14

Solid Walls

How do you make solid walls that sprites cannot walk through?

Thanks for any help.

Offline

 

#2 2010-05-25 08:54:25

06dknibbs
Scratcher
Registered: 2008-01-29
Posts: 1000+

Re: Solid Walls

There's a few methods  smile

Colour Recognition, Hit Tests etc:

The easiest method is this though:

<when green flag clicked>
<if><key[ Right ]pressed?>
<move( 1,2,3 etc: )steps>
<if><touching color[ Black (Or the colour of your walls)
<move( -1,2,3 etc: )steps>
<end>

And then just repeat that for all directions  smile

Last edited by 06dknibbs (2010-05-25 08:54:47)


http://i404.photobucket.com/albums/pp129/06dknibbs/Untitled-3-6.jpg

Offline

 

#3 2010-05-25 08:56:11

meew0
Scratcher
Registered: 2010-02-22
Posts: 1000+

Re: Solid Walls

06dknibbs wrote:

There's a few methods  smile

Colour Recognition, Hit Tests etc:

The easiest method is this though:
[blocks]
<when green flag clicked>
<if><key[ Right ]pressed?>
<move( 1,2,3 etc: )steps>
<if><touching color[ Black (Or the colour of your walls)
<move( -1,2,3 etc: )steps>
<end>
[/blocks]
And then just repeat that for all directions  smile

I would replace [blocks]<touching color[ Black[blocks]
with [blocks]<touching[ wall[/blocks].


http://i.imgur.com/mJV3j.pnghttp://i.imgur.com/HwWAX.pnghttp://i.imgur.com/sZ7Ui.pnghttp://i.imgur.com/0y6yh.pnghttp://i.imgur.com/nOC4l.png

Offline

 

#4 2010-05-25 08:58:41

06dknibbs
Scratcher
Registered: 2008-01-29
Posts: 1000+

Re: Solid Walls

meew0 wrote:

06dknibbs wrote:

There's a few methods  smile

Colour Recognition, Hit Tests etc:

The easiest method is this though:
[blocks]
<when green flag clicked>
<if><key[ Right ]pressed?>
<move( 1,2,3 etc: )steps>
<if><touching color[ Black (Or the colour of your walls)
<move( -1,2,3 etc: )steps>
<end>
[/blocks]
And then just repeat that for all directions  smile

I would replace [blocks]<touching color[ Black[blocks]
with [blocks]<touching[ wall[/blocks].

Sprite's work too xD

Although it depends on the project..

Project with a lot of sprites: Use a wall sprite = Easier  smile
Project with 2 - 3 sprites: Probably simpler to use a colour etc:

*Goes to look for a guide..*

Edit: http://scratch.mit.edu/projects/fireball123/940816/

^ I can't view projects on school computers at the moment, but it sounds like it might help.

Last edited by 06dknibbs (2010-05-25 09:00:24)


http://i404.photobucket.com/albums/pp129/06dknibbs/Untitled-3-6.jpg

Offline

 

#5 2010-05-27 17:08:04

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: Solid Walls

infinitum3d wrote:

Is it possible to interrupt the "Glide To" command?

I don't think so...


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

Board footer