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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
luaiscool
Prole
Posts: 34
Joined: Mon Apr 21, 2014 11:03 pm

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

Post 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
http://xkcd.com/979/

Code: Select all

if signature = true then
    print(signaturetext)
else
    print("Error: Signature Not Found")
end
User avatar
ArchAngel075
Party member
Posts: 319
Joined: Mon Jun 24, 2013 5:16 am

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

Post 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.
luaiscool
Prole
Posts: 34
Joined: Mon Apr 21, 2014 11:03 pm

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

Post 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.
http://xkcd.com/979/

Code: Select all

if signature = true then
    print(signaturetext)
else
    print("Error: Signature Not Found")
end
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 72 guests