0 Replies Latest reply on Jan 26, 2007 5:18 PM by AliveMedia

    dot race games/scripting

    AliveMedia
      Hi,

      new to the forum. Looks like really helpful place.

      I'm trying to put together a pretty simple dot race where you simply press play and it generates a random race winner. I've been able to figure out how to do that with just having the objects move to right from left using math.random (see below). I'm wondering, though, how do I get the racing movie clips to follow a motion trail instead of just moving from left to right. Any ideas? Thanks!

      AJ

      // ON movieclip
      onClipEvent (enterFrame) {
      // Start IF statement
      if (_root.raceover == 0) {
      // ID of DOT ( change this on every dot 1-2-3 etx)
      id = 1;
      // Movement of DOT
      ran = math.round(math.random()*7+3);
      this._x += ran;
      // Finnish line
      if (this._x>500) {
      _root.raceover = 1;
      _root.winner = id;
      }
      }
      // Get all dots to return
      if (_root.raceover == 1) {
      // Start porition
      this._x = 25;
      }
      }
      Edit/Delete Message