Page 1 of 1

How can I match my x and y coords and rotation too

Posted: Fri May 30, 2014 12:35 pm
by luaiscool
Hello! Now I was wondering as I am currently working on a pirate game how can I have an enemy pirate ship pull up about 10-30 pixels(will decide later) and have a horizontal rotation plus using some sort of shooting mechanism. The shooting mechanism I don't care much I can do that my self but how can I have it pull 10-30 pixels away from the right side of my ship no matter how I am rotated?

Thanks in advance!
LIC

Re: How can I match my x and y coords and rotation too

Posted: Fri May 30, 2014 6:05 pm
by ArchAngel075
If you know the rotation of the players ship - you can easily get a broadside rotation by matching the rotation of the enemy to the player.

Next get the distance between the two, and do movement that attains a position 10-30 Units away from the player(where Units is a arbitrary unit of measurement, ie Meters)

now to be allways on the players broadside (for some fun broadsiding exchanges) just take the players rotation and add a rotation of 90 or 270 which puts it allways aside the player.

so :

Match rotation
Use distance check and movement to attain 10-30 Units spacing
Use a point at a 90 or 270 degree angle 10-30 Units away from the player to ensure broadsiding one another.

I tried avoiding giving code incase you prefer a (more encouraged generally) code-it-yourself approach.

Re: How can I match my x and y coords and rotation too

Posted: Fri May 30, 2014 8:44 pm
by luaiscool
ArchAngel075 wrote:If you know the rotation of the players ship - you can easily get a broadside rotation by matching the rotation of the enemy to the player.

Next get the distance between the two, and do movement that attains a position 10-30 Units away from the player(where Units is a arbitrary unit of measurement, ie Meters)

now to be allways on the players broadside (for some fun broadsiding exchanges) just take the players rotation and add a rotation of 90 or 270 which puts it allways aside the player.

so :

Match rotation
Use distance check and movement to attain 10-30 Units spacing
Use a point at a 90 or 270 degree angle 10-30 Units away from the player to ensure broadsiding one another.

I tried avoiding giving code incase you prefer a (more encouraged generally) code-it-yourself approach.
Could you possiby give code? I would like that.