[HELP] Bouncing ball problem
Jochen F. Rick
nadja at cc.gatech.edu
Fri Oct 6 21:01:13 UTC 2000
Hello Adam,
I think it isn't infinite. It's just really long.
The first time you do '0 to 29' thing, you get a half bounce. 'path :=
path, path reversed' gives you a full bounce.
When you do it the second time, path is 1.5 bounces after the '0 to 29'
thing. 'path := path, path reversed' give you 3 bounces.
Third time, 3.5 => 7 bounces
Fourth time, 7.5 => 15 bounces
Fifth time, 15.5 => 31 bounces
Sixth time, 31.5 => 63 bounces
You can fix this in several ways. One way to change this might be call
the first full bounce just a bounce. Then, you could do
path := OrderedCollection new.
1 to: 5 do: [:i | path := path, bounce].
Note the 1 instead of the 0 (0 to 5 would give you 6 iterations).
Peace and Luck!
Je77
On Fri, Oct 06, 2000 at 07:28:39PM +0000, Adam Bloom wrote:
> This may seem like a elementary problem to most of you, however its not to
> me, I'm working with the "TestMorph" that is created in John Maloney's
> Morphic tutorial, I'm trying to make it bounce five times, however it just
> bounces on forever, heres the code
>
> #TestMorph Method
> startAnimation
> path := OrderedCOllection new.
> 0 to: 5 do: "This is the part that is supposed to make it bounce 5
> times"
> [:h | 0 to: 29 do: [:i | path add: self position + (0@(i squared /
> 5.0)))]. "This makes it go"
> path := path, path reversed]. "This makes it go up and down"
> self startStepping.
>
> Any help?
>
> Adam
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
> Share information about yourself, create your own public profile at
> http://profiles.msn.com.
More information about the Squeak-dev
mailing list
|