Timeline for Rotate a Crosshair around a sprite - 2d worms style game?? (LibGDX)
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 13, 2016 at 23:02 | comment | added | Big T Larrity | by the way, thank you again for the answer Hunter99. I have now got it working and your answer was basically a full walkthrough. | |
Nov 13, 2016 at 22:40 | vote | accept | Big T Larrity | ||
Nov 11, 2016 at 18:43 | comment | added | Hunter99 |
My answer is written for LibGDX so you don't necessarily need to use Felsirs line of code because LibGDX will do the same with distanceVector.setAngle(angle);
|
|
Nov 11, 2016 at 16:30 | comment | added | Big T Larrity | Thanks also Felsir as I will try to use Cos and Sin together with Hunter99 answer above and I think it may just have clicked in my head. Hopefully when i get home I can find out :) | |
Nov 11, 2016 at 16:28 | comment | added | Big T Larrity | thank you for the indepth answer. I am not at home now but will try to implement this when i am back. One thing though, I had already managed (since posting question) to create them variables and make the crosshair position relative to the player vector. But Im unsure of the code to use when person presses UP or DOWN key. Im using libgdx java and I think it does support angle and has some rotation method but i can only know how to make the sprite itseld rotate at the moment. | |
Nov 11, 2016 at 10:39 | comment | added | Felsir |
Note that if you work with a language/framework that doesn't support setting an angle to a vector, use the cos and sin of the angle to get the position: crosshairVector = playerVector + new Vector2(Cos(angle),Sin(angle)) * crosshairDistance
|
|
Nov 11, 2016 at 10:37 | review | First posts | |||
Nov 11, 2016 at 12:26 | |||||
Nov 11, 2016 at 10:31 | history | answered | Hunter99 | CC BY-SA 3.0 |