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

#1 2011-06-27 19:23:06

Shin23
Scratcher
Registered: 2011-01-30
Posts: 100+

Top-down wall sensing?

I can't figure out a good way to do top down wall sensing. This is how I don it now:
[blocks]
<when green flag clicked>
<forever>
<if><key[ up arrow ]pressed?>
<if><touching color[ color of wall
<change y by(-3)
<else>
<change y by(3)
<end>
[/blocks]

It seems like it would work, but there's a problem. Sometimes you'll keep crashing up against the wall, and then when you stop, you're touching the wall. So, if you press like the down arrow, you'll move up through the wall! Can someone help me with a better way of doing things? Thanks!


http://scratch.mit.edu/static/projects/Shin23/1957329_med.png New Super Mario Bros. Scratch! (beta)
PSN: shauthegreat23

Offline

 

#2 2011-06-27 19:33:25

TheBajeebas
Scratcher
Registered: 2010-04-26
Posts: 1000+

Re: Top-down wall sensing?

u can use this if u want: http://scratch.mit.edu/projects/TheBajeebas/1177833


http://i.imgur.com/jOkeD.jpg

Offline

 

#3 2011-06-27 21:44:59

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Top-down wall sensing?

Try this:
http://i55.tinypic.com/ftouhd.gif

Last edited by Kileymeister (2011-06-27 21:45:09)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#4 2011-06-28 00:56:01

AtomicBawm3
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: Top-down wall sensing?

Or, in way this is like what Kiley said:

when clicked
forever
if up arrow pressed:
   change y by 3
   if touching wall or wall color
      change y by -3
if down arrow pressed:
   change y by -3
   if touching wall or wall color
       change y by 3


http://i50.tinypic.com/j0yw0p.jpg

Offline

 

#5 2011-06-28 11:29:51

Shin23
Scratcher
Registered: 2011-01-30
Posts: 100+

Re: Top-down wall sensing?

Kileymeister wrote:

Try this:
http://i55.tinypic.com/ftouhd.gif[/url]

THANK YOU SO MUCH THAT'S PERFECT!!!!!!

Last edited by Shin23 (2011-06-28 11:30:42)


http://scratch.mit.edu/static/projects/Shin23/1957329_med.png New Super Mario Bros. Scratch! (beta)
PSN: shauthegreat23

Offline

 

#6 2011-08-09 15:37:21

moose12141
Scratcher
Registered: 2008-04-03
Posts: 57

Re: Top-down wall sensing?

Wall sensing is hard.

Offline

 

Board footer