Discuss Scratch

CaptainNinjaComics
Scratcher
21 posts

Sensing.

How do you make things bounce off of things in the direction you hit it in? Also, how do you make something stop at a certain sprite other than the edge of the stage?
scubajerry
Scratcher
1000+ posts

Sensing.

There are several answers to the first part of your question, base on how you are moving.

// you can use this
if on edge, bounce

// if you are moving in a certain direction you can use
if <touching [edge v]> then
set (direction) to <(180) - (direction)>
end

//If you are moving with X and Y velocities, you can change the sign of the one of the velocities, based on which wall you hit. See

http://scratch.mit.edu/projects/13152873/


scubajerry
Scratcher
1000+ posts

Sensing.

The answer to the second part also has to do with how your are moving.

You can put your movement blocks in an if
if <not(touching [sprite1 v]> then
move (5) steps
end

//

if (touching [sprite1 v] then
set (X velocity) to (0)
set (Y veliocity) to (0)
end

Powered by DjangoBB