angle movement ?
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: angle movement ?

  1. #1
    Member
    Join Date
    Aug 2002
    Location
    Turkiye
    Posts
    90

    angle movement ?

    i want to move a movieClip from one point other by an angle..
    anybody knows how it can be done ?

  2. #2
    Senior Member
    Join Date
    Jan 2002
    Posts
    368
    first decide the angle.
    then decide the speed.
    then convert the angle to radians.
    take cosine of angle (in radians) and multiply by speed.
    that's your x speed.
    take sine of angle and multiply by speed.
    that's your y speed.
    add x and y speed to _x and _y position.

    Code:
    angle=53;
    speed=5;
    rad=angle*Math.PI/180;
    xspeed=Math.cos(rad)*speed;
    yspeed=Math.sin(rad)*speed;
    yourclip._x+=xspeed;
    yourclip._y+=yspeed;
    repeat last two steps for continued motion.

  3. #3
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,001
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  4. #4
    Member
    Join Date
    Aug 2002
    Location
    Turkiye
    Posts
    90

    thanks but..

    thanx guys..but this not what i want..
    i want mc to stop on an exact point..
    thanks anyway...

  5. #5
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,001
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  6. #6
    Member
    Join Date
    Aug 2002
    Location
    Turkiye
    Posts
    90

    ...

    i appologise..your code is cool, but i want the mc moves from 10|10 to 250|300
    by angle=30.

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

Poll by Flashkit.com