bbbeb wrote:
<if <touching color [bounce color]>>
turn (direction-180)degrees
move (number) steps.
Now mods, please close this.![]()
I wouldn't really say that's the BEST way of bouncing, you should right add the direction bouncing like the scratch block "if on edge, bounce" does. I can't remember what the math formula is exactly, though...
Last edited by LS97 (2010-09-26 03:27:57)
Offline
LS97 wrote:
bbbeb wrote:
<if <touching color [bounce color]>[/blocks]>
turn (direction-180)degrees
move (number) steps.
Now mods, please close this. :DI wouldn't really say that's the BEST way of bouncing, you should right add the direction bouncing like the scratch block "if on edge, bounce" does. I can't remember what the math formula is exactly, though...
I think MathWizz (:P) had a project for doing this.
Last edited by nXIII (2010-09-26 10:27:20)
Offline
nXIII wrote:
LS97 wrote:
bbbeb wrote:
<if <touching color [bounce color]>[/blocks]>
turn (direction-180)degrees
move (number) steps.
Now mods, please close this.![]()
I wouldn't really say that's the BEST way of bouncing, you should right add the direction bouncing like the scratch block "if on edge, bounce" does. I can't remember what the math formula is exactly, though...
I think MathWizz (
) had a project for doing this.
well, really all of the projects that use bouncing which is not on edge have it. even I made one once....
Offline
nXIII wrote:
LS97 wrote:
bbbeb wrote:
<if <touching color [bounce color]>[/blocks]>
turn (direction-180)degrees
move (number) steps.
Now mods, please close this.![]()
I wouldn't really say that's the BEST way of bouncing, you should right add the direction bouncing like the scratch block "if on edge, bounce" does. I can't remember what the math formula is exactly, though...
I think MathWizz (
) had a project for doing this.
I've got one too, right here. It does bouncing off of horizontal and vertical surfaces. If you want inclined surfaces, things get more complicated, but I do have some examples here and there, if you are interested.
Offline
Paddle2See wrote:
nXIII wrote:
LS97 wrote:
I wouldn't really say that's the BEST way of bouncing, you should right add the direction bouncing like the scratch block "if on edge, bounce" does. I can't remember what the math formula is exactly, though...I think MathWizz (
) had a project for doing this.
I've got one too, right here. It does bouncing off of horizontal and vertical surfaces. If you want inclined surfaces, things get more complicated, but I do have some examples here and there, if you are interested.
Yea, I was referring to this project. It has a few glitches, but it does things pretty well.
Offline
Its simple!!!
If you want it to bounce off a verticle surface use this code
<when green flag clicked>
<forever>
<if><touching[ sprite1 ]
<point in direction( ((<direction> <*>-1 ))
<wait until><< <not><touching[ sprite 1] >>
<end>
To bounce off a horizontal surface instead of point in direction direction * -1
say: point in direction direction * -1 -180
hope it helps
Offline
When Flag Clicked
forever
[
if <touching wall>
[
point in direction ( 0 - (direction) )
repeat until < not <touching wall> >
[
move 3 steps
]
]
]
Offline
to make a realistic bounce, make a variable called "y velocity" then put "forever: if touching color( ) or sprite ( ): set velocity to 15 or whatever you choose. then outside of the if loop, change velocity by : -1 change Y by velocity. put all that in a forever loop. hope that helps
Offline