Pages: 1
Topic closed
Basically, I'd like a character to be able to hit the side of an object but not go through. I've seen projects which do this but I really don't understand them.
Offline
Here's a simple example. The sprite balls bounce off of each other and the walls.
http://scratch.mit.edu/projects/hamimiami/142491
Basically within the script for a Sprite you check to see if it is touching another sprite.
If it is touching then you either change the direction of the sprite or stop the movement of it so it doesn't pass through the other one.
Ask if you have any questions.
Offline
But is it possible so that it may hit a particular side and bounce off, except the top. For example, if it hits the bottom, can it not go through, and if it hits the right, can it not go through?
Offline
maybe
<when green flag clicked>
<forever if><touching color[ whatever the thing it not supposed to touch color
<move( -10 )steps>
Offline
Topic closed
Pages: 1