# Ship rotates and flips according to mouse potition?

**URL:** <https://forum.kirupa.com/t/ship-rotates-and-flips-according-to-mouse-potition/308482>\
**Category:** flash\
**Created:** [April 23, 2010, 5:13pm UTC](https://forum.kirupa.com/t/ship-rotates-and-flips-according-to-mouse-potition/308482 "2010-04-23T17:13:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amymation](https://avatars.discourse-cdn.com/v4/letter/a/bc8723/32.png) [@Amymation](https://forum.kirupa.com/u/Amymation)\
**Post date:** [April 23, 2010, 5:13pm UTC](https://forum.kirupa.com/t/ship-rotates-and-flips-according-to-mouse-potition/308482/1 "2010-04-23T17:13:18Z")

</div>

Hey there. Been making a site and came across a problem. I want to have a ship movieclip follow the mouse slowly and rotate and flip on horizontal axis according to the mouse potition. I’ve been looking on this forum and can’t find much help. Here’s the code on the timeline I got so far but it just makes the movieclip follow the mouse;

```auto
ship_mc.onEnterFrame = function() {
    var xMouse = _root._xmouse;
    var yMouse = _root._ymouse;
    if(Math.abs(xMouse - this._x) < 1) {
        this._x = xMouse;
        this._y = yMouse;
    } else {
        this._x -= (this._x-xMouse) / 80;
        this._y -= (this._y-yMouse) / 80;
    }
}

```

I’ve attached the source file. If anyone can help it’ll be much apprechiated!

Also I’d like to learn aswell so code comments are welcomed!

- Amy
