mrweston wrote:
Try the other way around: 180 - (direction of Sprite)
![]()
I'm sure that's right, but it doesn't work... But I think there's something wrong with Scratch rather than the calculation because:
Say the direction of sprite 1 is -45 and when the light touches sprite 2, it does:
180 - -45 which is 225 by my calculations.
But Scratch gives a completely diferent answer.
Can anyone see why?
Offline
Have it move five steps in that direction directly after otherwise it is still touching the object.
Offline
Dan01 wrote:
mrweston wrote:
Try the other way around: 180 - (direction of Sprite)
![]()
I'm sure that's right, but it doesn't work... But I think there's something wrong with Scratch rather than the calculation because:
Say the direction of sprite 1 is -45 and when the light touches sprite 2, it does:
180 - -45 which is 225 by my calculations.
But Scratch gives a completely diferent answer.
Can anyone see why?
The answer will be negative, because Scratch only supports directions between -180 and 180.
Offline
Exactly. The correct opposite of -45° is 45°. When we do 180° - (-45°), we get 225°. But then when you drop that answer into a Direction block, it "wraps" the number around within the -180-to-180 system: i.e., since it can't be larger than 180°, it wraps to zero, then counts from there. So 225° becomes 45°.
Does that help?
Offline
mrweston wrote:
Exactly. The correct opposite of -45° is 45°. When we do 180° - (-45°), we get 225°. But then when you drop that answer into a Direction block, it "wraps" the number around within the -180-to-180 system: i.e., since it can't be larger than 180°, it wraps to zero, then counts from there. So 225° becomes 45°.
Does that help?![]()
Yea. Thanks to everyone that posted
Offline