C# animation - move object from A to B or by angle

Posted by Nullstr1ng on Stack Overflow See other posts from Stack Overflow or by Nullstr1ng
Published on 2010-06-17T16:28:17Z Indexed on 2010/06/17 16:53 UTC
Read the original article Hit count: 262

Filed under:
|

Hi am just doing a little animation which moves an object from point a to point b or by angle/radians.

what I currently have is this

Point CalcMove(Point pt, double angle, int speed)
    {
        Point ret = pt;

        ret.X = (int)(ret.X + speed * Math.Sin(DegToRad(angle)));
        ret.Y = (int)(ret.Y + speed * Math.Cos(DegToRad(angle)));

        return ret;
    }

but it doesn't look what i expected.

please help?

update: oh and am using NETCF

© Stack Overflow or respective owner

Related posts about c#

Related posts about animation