8 Replies Latest reply on Jun 17, 2007 5:02 PM by kglad

    limiting area of MC movement

    Jimmathy Level 1
      I have a char MC and then a background of tiles. Some of the areas on the stage(or tiles) I dont want the char to be able to walk on. My first idea failed, it was:
      -putting several MCs called block1-7 on the stage where I didnt want the char to walk, and then in my movement script test for any collision with any of the blocks and stop movement. However this was foiled because it went so slow that flash couldnt handle it.
      -My second attempt was to combine all the "block" MCs in to one big clip the shape of the area I wanted unwalkable. This didnt work because apparently hitTest goes by the bounding box and not where the actual contents of the clip are. Therefore the char could never walk because he was ALWAYS inside the bounding box.

      So how would I limit the area that he could walk? Any Ideas would be much appreciated. My coding(which is executed one enterframe by a blank MC off the screen) is attached below.

      NOTE:the background, although made of tiles, is not created thru actionscript
      ALSO NOTE: this is NOT a tile based game with and array map, my character is larger than each tile so, as far as im concerned that is not an option
      What do you think?