2 Replies Latest reply on Oct 23, 2006 11:54 AM by The_Real_Ciber

    Collision Detection Help

    The_Real_Ciber
      Okay, first take a look at my current collision script:
      quote:


      if (_root.man.hitTest(_parent.land.clip16) or _root.man.hitTest(_parent.land.clip22) or _root.man.hitTest(_parent.land.clip1) or _root.man.hitTest(_parent.land.clip2) or _root.man.hitTest(_parent.land.clip15) or _root.man.hitTest(_parent.land.clip20)) {UPmoveSpeed=0
      }
      else if (Key.isDown(Key.SHIFT)) {UPmoveSpeed=4
      } else {
      if (Key.isDown(Key.END)) {
      if (_root.car==1) {
      UPmoveSpeed=8 } } else {
      UPmoveSpeed=2 }
      }
      if (_root.man.hitTest(_parent.land.clip3) or _root.man.hitTest(_parent.land.clip28) or _root.man.hitTest(_parent.land.clip27) or _root.man.hitTest(_parent.land.clip25) or _root.man.hitTest(_parent.land.clip4) or _root.man.hitTest(_parent.land.clip13)) {LEFTmoveSpeed=0
      }
      else if (Key.isDown(Key.SHIFT)) {LEFTmoveSpeed=4
      }
      else {
      if (Key.isDown(Key.END)) {
      if (_root.car==1) {
      LEFTmoveSpeed=8 } } else {
      LEFTmoveSpeed=2 }
      }
      if (_root.man.hitTest(_parent.land.clip5) or _root.man.hitTest(_parent.land.clip26) or _root.man.hitTest(_parent.land.clip6) or _root.man.hitTest(_parent.land.clip21) or _root.man.hitTest(_parent.land.clip23) or _root.man.hitTest(_parent.land.clip19)) {RIGHTmoveSpeed=0
      }
      else if (Key.isDown(Key.SHIFT)) {RIGHTmoveSpeed=4
      }
      else {
      if (Key.isDown(Key.END)) {
      if (_root.car==1) {
      RIGHTmoveSpeed=8 } } else {
      RIGHTmoveSpeed=2 }
      }
      if (_root.man.hitTest(_parent.land.clip8) or _root.man.hitTest(_parent.land.clip24) or _root.man.hitTest(_parent.land.clip12) or _root.man.hitTest(_parent.land.clip0)) {DOWNmoveSpeed=0
      }
      else if (Key.isDown(Key.SHIFT)) {DOWNmoveSpeed=4
      }
      else {
      if (Key.isDown(Key.END)) {
      if (_root.car==1) {
      DOWNmoveSpeed=8 } } else {
      DOWNmoveSpeed=2 }
      }



      It's a huge script because it's for my city, each wall (side of street) has it's own MC and all ties into this.

      I was wondering if anyone would be nice enough to help me make a better one :)?

      I once saw one where they had an invisible MC with red squares, when you hit them you stoped, they were all in 1 MC and very small coding.

      Anyone have any idea what I mean :(?

      Update: Heres an example of what I mean, the first image is the blockers, the second is the regular city.
      Image

      Thanks for your help :)