2 Replies Latest reply on Sep 14, 2006 11:23 AM by Newsgroup_User

    lottery ball machine

    trilbymultimedia
      Hi
      I'm making a lottery ball machine, got the number selection and ball display working fine, but I want some balls to appear to be jumping around in the background as if blown by a fan from underneath.

      I've never scripted any dynamic movement before, any ideas where to start?

      Cheers
      B.
        • 1. Re: lottery ball machine
          Applied CD Level 1
          The following is really crude but at least it will start your balls bouncing. Paste the code into a behavior and attach the behavior to a handful of ball sprites. When pDirection is -1 the ball will move up, when it’s +1 the ball will move down, when it’s 0 the ball is hovering. pSpeed is the number of pixels the ball will move per frame, pDuration is the number of frames the ball will move before changing direction. The movement would be much more realistic if you added some vertical “jitter” when hovering … also, rather than using the same random number range each time I’d experiment with using a series of smaller moves spiked by a few random larger moves.
          -------------------------------------------
          • 2. Re: lottery ball machine
            Level 7
            >I've never scripted any dynamic movement before, any ideas where to start?

            This brilliant site can be a start:
            http://www.jmckell.com/