Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2006
    Location
    Tampa Bay, FL
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Changing Speed of Falling Objects

    I don't see where I can change the speed of the objects (leaves) falling in this code. Can someone point it out to me?

    Click on this link and view source to see what I'm talking about:

    http://pages.prodigy.net/bluebutterf...Background.htm

  • #2
    Regular Coder
    Join Date
    Jun 2006
    Posts
    225
    Thanks
    6
    Thanked 3 Times in 3 Posts
    Code:
    Speed[i]= Math.random()*5+3;
    At the moment, the speed is a random number between 0 and 1, multiplied by 5, and then the result is increased by 3.

    I'd suggest changing the +3 if you wish to make them overall faster/slower, increase the multiplier to increase the range of speeds, decrease to decrease, etc.

  • #3
    New Coder
    Join Date
    Aug 2006
    Location
    Tampa Bay, FL
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you. It worked. I actually already tried that, only I didn't see that there were two places I needed to change that particular number.

    Thanks again.

    ~Keystroke
    Last edited by keystroke; 08-28-2006 at 06:40 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •