Hello
I need some help please! I am new to Scratch and having a heck of a time getting my sprite (basketball) to bounce off my 2nd sprite (wall). I am using an angle variable and want the ball to bounce off the wall at the same angle it hit the wall (reflection).
I loaded my project under Transformed71506
Any help would be awesome! Let me know if you need any further information.
Thanks!
Offline
This is what I have so far:
blocks
<when green flag clicked>
<clear>
<pen up>
<go to x -200 )y
-50 )
<point in direction( 0 )
<turn cw( <{ angle }> )degrees>
<move( 150 )steps>
<if><color[ red ]is touching[ black ]
<turn cw( <{ angle }> )degrees><end>
<move( 150 )steps>
/blocks
Offline
Under examples, there is a project called pong that will probably help a lot!
-12three-
Offline
So you mean:
[Point in direction (180-angle)]
And place it where in the blocks?
I am sorry. I am such a rookie!
Thanks!
Offline
Ah. Sorry. Just put this script within the movement script.
If <touching wall> point in direction (180 - direction) repeat until <not <touching wall> > move (whatever) steps end end
The forever if script is important, because it keeps the sprite from bouncing several times.
Last edited by Harakou (2010-09-28 21:25:16)
Offline
I am still so lost!
I tried your code and it still would not work.
I am ok until the 1st <turn cw( <{ angle }> )degrees>
I was working on getting the ball to move so that is why I added <move( 150 )steps>
I was playing with the glide block but it kept going over the wall.
I need for the ball to sense the wall, bounce off at the same angle it initially hit, and stop.
I keep adjusting blocks but nothing seems to work!
Any suggestions???
Offline
Got it!
Thanks for all your help Scratch Community!
Offline