Sign in to follow this  
jonod

diagonal movement (dumb question)

Recommended Posts

first post on this forum so bear with me. i have a game which implements 8-way movement. i have a gamepice located at x, y and want him to move diagonally northeast. the gamepiece has a 'speed' property which indicates how far it moves during a frame. if the starting position is 0, 0 what are the final x,y if the game piece has a speed of 100? what would be the formula to work out the movement in any direction. i figure you need to use radians (in my case 45, 90, 135, 180 etc) and trig but its a long time since i left school and i threw out all my books! message to kids reading this board: don't burn your school books on your last day of school!! (no matter how tempting ;)

Share this post


Link to post
Share on other sites
Quote:
Original post by stro

x = 100cos(Angle)
y = 100sin(Angle)


thanks for quick reply, but say the character was already at x=400, y=200 and has movement of 100, how would i use this equation taking into account the current postion to work out where it will end up?





Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this