dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Help with simplifying code

  1. #1
    Senior Member
    Join Date
    Dec 2009
    Posts
    109

    Question Help with simplifying code

    Hello, I have made a AS 2.0 script that allows an object to ease into rotation. Here is the code:

    Code:
    _root.onEnterFrame = function(){
    	rot = Math.atan2(_ymouse-arrow._y,_xmouse-arrow._x)*180/Math.PI;
    	if(arrow._rotation-rot>180){
    		rot += 360
    	}
    	if(arrow._rotation-rot<-180){
    		rot -= 360
    	}
    	arrow._rotation += (rot-arrow._rotation)/3;
    }
    Is this the best way to write it, or is there something more simple that I can do?
    Syntax Error

  2. #2
    Senior Member Computer Dork's Avatar
    Join Date
    Mar 2001
    Location
    St. Louis
    Posts
    1,026
    Go to tweenmax.com - download tweenmax for as2.

    Much simpler, many options, easy to use.

  3. #3
    Senior Member
    Join Date
    Dec 2009
    Posts
    109
    Thats not really what I am looking for. I have created my own program that makes arrays of rotations. I then copy those arrays into my game, and I can reference to them and dynamically combine them into poses and animations for my characters. All I need to know is if there is a better way to write my easing code.
    Syntax Error

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center