2 Replies Latest reply on Feb 9, 2008 8:37 AM by clbeech

    Applying actionscript for character movement

      Im applying this code to a character but cannot work out where im going wrong! Anyone?

        • 2. Re: Applying actionscript for character movement
          clbeech Level 3
          well... I'm afraid i see several things wrong here, some could be typos though :) Instead of using clipEvents, you should place this code on the main timeline, and run it within an onEnterFrame loop to capture key strokes and effect character movements. first I don't see where you've declared these variables previous to the methods, therefore in most cases they will remain local to the method and not accessible from outside that method, which is probably the main problem here. I also see that it looks as though there are some things that conflict with movements, particularly with the 'jumping' part. I would try this, give the character an instance name (I'll use 'joe') then create a new layer, call it 'actions' and place your codes on that layer only (it is a 'best practice' to do so and not attach code to Object instances) I would use something like the following: