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

#1 2012-05-03 13:31:52

Lilhardy94
Scratcher
Registered: 2012-04-12
Posts: 25

stopping

how do i make one sprite not able to go through another kind of like pac-man not being able to go thru walls?

Offline

 

#2 2012-05-03 14:03:18

PhirripSyrrip
Scratcher
Registered: 2012-02-11
Posts: 100+

Re: stopping

Make it always point in the direction it's facing. For example, you could use this script:

when gf clicked
forever
if <key [left arrow v] pressed?>
point in direction (-90)
move [10] steps
end
if <key [right arrow v] pressed?>
point in direction (90)
move [10] steps
end
if <key [up arrow v] pressed?>
point in direction (0)
move [10] steps
end
if <key [down arrow v] pressed?>
point in direction (180)
move [10] steps
end
Then add a script like this:
forever
if <touching [wall v]?>
move [-10] steps
end


http://i46.tinypic.com/ao03lk.png

Offline

 

Board footer