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

#1 2011-02-14 13:31:09

cdens32i
New Scratcher
Registered: 2011-02-11
Posts: 3

sprites not going through other sprites

for my project, Blow the Car, i need to make sure that a car does not go through a grey block sprite.  how do i do this? plz help!  smile

Offline

 

#2 2011-02-14 13:46:53

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: sprites not going through other sprites

Make two private variables (for this sprite only) named last x pos and last y pos. Then add this script:
[blocks]<when green flag clicked>
<forever>
<set{ last x pos }to( <x position>
<set{ last y pos }to( <y position>
<if><touching[ wall sprite
<go to x sad  <{ last x pos }> )y sad  <{ last y pos }>
<end>
<end>[/blocks]

Offline

 

Board footer