A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [HELP] Rotation...?

  1. #1
    Member
    Join Date
    Dec 2003
    Location
    Here.
    Posts
    48

    [HELP] Rotation...?

    My movie clip's rotation is very, very choppy. I have the character being able to walk, and then I inserted the rotation code into the mix. When I try to turn, it "rotates" my character to another part on the screen just a little bit away, rather than rotating him on the spot where he is. I have the white center dot placed at his center (which was easy, since I'm using a circle with an arrow on his head for this test), but it still skips him a bit away.

    Any suggestions on how to fix this problem? Here's the [very basic] code, if anyone needs it in order to help me:


    onClipEvent (load) {
    s = 5;
    }
    onClipEvent (enterFrame) {
    if(Key.isDown(Key.RIGHT)) {
    _rotation = 90;
    _x += s;
    }
    if(Key.isDown(Key.LEFT)) {
    _rotation = 270;
    _x -= s;
    }
    if(Key.isDown(Key.UP)) {
    _rotation = 0;
    _y -= s;
    }
    if(Key.isDown(Key.DOWN)) {
    _rotation = 180;
    _y += s;
    }
    if(Key.isDown(Key.UP) and Key.isDown(Key.RIGHT)) {
    _rotation = 45;
    }
    if(Key.isDown(Key.UP) and Key.isDown(Key.LEFT)) {
    _rotation = 315;
    }
    if(Key.isDown(Key.DOWN) and Key.isDown(Key.RIGHT)) {
    _rotation = 135;
    }
    if(Key.isDown(Key.DOWN) and Key.isDown(Key.LEFT)) {
    _rotation = 225;
    }
    }
    Ding.

  2. #2
    Amiga freak Ironclaw's Avatar
    Join Date
    Jan 2001
    Location
    Sweden
    Posts
    1,650
    Are you sure your character are in the center of the MC?. Seems like he's not.

  3. #3
    Member
    Join Date
    Dec 2003
    Location
    Here.
    Posts
    48
    I'm not quite sure what you're asking, unless you're talking about the white center dot.

    Here's what other information I can tell you: I have the white center dot in the middle, which I can confirm because when I manually free transform him in the .fla rather than try to use the arrow keys in the final .swf product, it can do a 360 turn rather than a space-skipping circle like the kind it does in the .swf with the arrow keys.

    If that was incoherent (which it may have been xD):
    .fla + manual rotation = smooth 360
    .swf + arrow keys using the code = choppy skips, forming a circle if I do them in order.
    Ding.

  4. #4
    Member
    Join Date
    Dec 2003
    Location
    Here.
    Posts
    48
    Of course, there is that little black "+" sign in the upper left hand corner of the symbol, could that be the problem that I have to move? I don't know how to move that, if that's it.
    Ding.

  5. #5
    Amiga freak Ironclaw's Avatar
    Join Date
    Jan 2001
    Location
    Sweden
    Posts
    1,650
    Yes... the + is the center of the MC.. so if you dont have your char in the center of that, the things you say happen, happens...

    which was what I was saying.. center the char.... so the + is in the middle of him.

  6. #6
    Member
    Join Date
    Dec 2003
    Location
    Here.
    Posts
    48
    Oh, thanks! Works perfect now, thanks a bunch =)
    Ding.

  7. #7
    Amiga freak Ironclaw's Avatar
    Join Date
    Jan 2001
    Location
    Sweden
    Posts
    1,650
    Np :P

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