This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-23 17:08:33

KatGames
Scratcher
Registered: 2012-01-20
Posts: 14

how do I make my sprite bounce off things?

I have been trying to figure out how to make my sprite jump from a spring.  So I went on youtube a didn't the results I w so wanted.  Can someone tell me the script? _meow_


You Can't beat level 1 or can you?
http://www.geocities.jp/z_gundam_tanosii/home/applet/Main.html

Offline

 

#2 2012-03-23 17:15:09

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: how do I make my sprite bounce off things?

It depends what you mean by "bounce".  If you want it to simply change direction, then the script is fairly simple.  If you want it to simply go up, wait, then come down, the script is also fairly simple.  However, if you want a "realistic" jump, with going up quickly, slowing, then speeding up as it falls, then you'll need to do a more complicated script using y velocity.   smile

Offline

 

#3 2012-03-23 18:51:14

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: how do I make my sprite bounce off things?

When gf clicked
Forever if <touching color [color of what you bounce off]?>
Point in direction <(0) - <[direction v] of [this sprite v]>>
Move (4) steps
If your moving by changing x and y do this instead:
When gf clicked
Forever 
If <<key [right arrow v] pressed?> and <touching color [color of bouncy thing]?>>
Change x by (-3)
end
If <<key [left arrow v] pressed?> and <touching color [same color]?>>
Change x by (3)
End
This is assuming that right arrow moves you right and left arrow moves you left. You continue the chain for up and down arrow also.

Last edited by turkey3 (2012-03-23 18:54:39)

Offline

 

Board footer