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

#1 2009-12-28 14:12:15

Filtaido
Scratcher
Registered: 2009-04-30
Posts: 33

Bouncing

Hey, can anyone tell me how to make a bouncy ball using variables and
    <touching color[ black]>?


84% of teenagers own cell phones.  Add this to your signature if you like pop tarts.  tongue

Offline

 

#2 2009-12-29 04:31:56

jacool
Scratcher
Registered: 2008-01-25
Posts: 1000+

Re: Bouncing

I will make a project to show you, I will give you a link when it's finished.


http://i571.photobucket.com/albums/ss159/JacobKar/svensktiger-1.png

Offline

 

#3 2009-12-29 04:51:20

jacool
Scratcher
Registered: 2008-01-25
Posts: 1000+

Re: Bouncing

Here's the link:
http://scratch.mit.edu/projects/JacoolFix/822303
Download and have a look at the scripts.


http://i571.photobucket.com/albums/ss159/JacobKar/svensktiger-1.png

Offline

 

#4 2009-12-29 06:54:01

Buggy132k9
Scratcher
Registered: 2009-12-19
Posts: 19

Re: Bouncing

Its probably too late, but if its a user controlled ball then you could put in the script where you control it:
On the change x by positive put If touching colour then change x by negative.
Same for the change x by negative, but if touching colour change x by positive.
For change y, its the same.

Offline

 

#5 2009-12-29 07:34:56

Brass45
Scratcher
Registered: 2009-05-03
Posts: 500+

Re: Bouncing

Use this script:
[blocks]
<when green flag clicked>
<go to x sad   0)y sad  0
<set{yvel  }to( 0
<forever>
<if><touching color[ black
<set{ yvel }to( ((yvel  <*> -0.93 ))
<else>
<change{yvel  }by(-1
<change y by( yvel
[/blocks]
I hope that helps you.


http://img412.imageshack.us/img412/4593/ubd1591.png<--Our website(click)
http://static.zooomr.com/images/8884671_b196719ffa_o.png<--If this image looks interesting,then click it to see an exclusive sneak peak of Evil Strings newest game:DarkLight

Offline

 

#6 2009-12-29 20:12:28

Filtaido
Scratcher
Registered: 2009-04-30
Posts: 33

Re: Bouncing

Thanks Guys!


84% of teenagers own cell phones.  Add this to your signature if you like pop tarts.  tongue

Offline

 

#7 2009-12-30 09:18:21

jacool
Scratcher
Registered: 2008-01-25
Posts: 1000+

Re: Bouncing

Brass45 wrote:

Use this script:
[blocks]
<when green flag clicked>
<go to x sad   0)y sad  0
<set{yvel  }to( 0
<forever>
<if><touching color[ black
<set{ yvel }to( ((yvel  <*> -0.93 ))
<else>
<change{yvel  }by(-1
<change y by( yvel
[/blocks]
I hope that helps you.

But when it touches black it won't bounce off, since the moving only works when it doesn't touch black.


http://i571.photobucket.com/albums/ss159/JacobKar/svensktiger-1.png

Offline

 

Board footer