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

#1 2009-06-03 18:57:17

Tylertyleer
Scratcher
Registered: 2009-06-03
Posts: 11

Please help. (the second)

How do  get it so if a bouncng sprite hits another sprite once it hits the very tip it bounces off. example: You know slime vollyball? How do I get the ball to bounce off the slime?  smile

Offline

 

#2 2009-06-03 21:14:19

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Please help. (the second)

Well, a simple way to bounce something off of a horizontal surface is to change the direction that the sprite is pointing by subtracting it from 180 degrees.  So if the sprite is coming in with direction 130 before the bounce, then set the new direction to 180-130 = 50 degrees

[blocks]
<when green flag clicked>
<forever>
<if><touching[ Bounce Object
   <point in direction( (( 180 <-> <direction> ))
   <wait until><<  <not> <touching[ Bounce Object >>
<end>
<end>
[/blocks]


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer